Sunday, February 26, 2017

All about containers

Here is the command to create a docker container by using google container image.

  docker run --rm gcr.io/google-containers/busybox
 
Use docker to run an interactive container from gcr

  docker run -i -t gcr.io/google-containers/busybox 
 
Use kubectl to run an interactive container from gcr 
 
  kubectl run -i -t tongbusy --image=gcr.io/google-containers/busybox
 
Attach to a running container in a pod.
 
  kubectl attach tongbusy-400598208-v0jpg -c tongbusy -i -t 
 
 
Install pypy to coreos
 
  wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-5.6-linux_x86_64-portable.tar.bz2
   
  tar xf pypy-5.6-linux_x86_64-portable.tar.bz2 
 
Check coreos releases:
 
  cat /etc/os-release
  

Inspect log files of systemd server

journalctl -u [unitfile]
 
for example, for a service named kube-apiserver, you should do the following:
 
   sudo journalctl -u kube-apiserver
 
 
Other kubernetes services checking log files:
 
sudo journalctl -u kube-controller-manager
sudo journalctl -u kube-scheduler
sudo journalctl -u kubelet
sudo journalctl -u kube-proxy    
 

Thursday, February 2, 2017

Get various networking related parameters by using basic bash command

vifcidr=$(ip -4 -o addr | grep -v '127.0.0.1' | awk '{print $4}’)
Find the cidr

vifbrd=$(ip -4 -o addr | grep -v '127.0.0.1' | awk '{print $6}’)
Find the broadcast address

vifmtu=$(ip -4 -o link | grep -v 'LOOPBACK' | awk '{print $5}’)
Find MTU

vifip=$(echo $vifcidr | awk -F '/' '{print $1 }')
Find IP address based on the cidr found above

vifname=$(ip -4 -o addr | grep -v '127.0.0.1' | awk '{print $2}')
Find the non-loopback interface card

defaultgw=$(ip route | awk '/default / {print $3}')
Find the default gateway ip address