Skip to content

Instantly share code, notes, and snippets.

@bikram20
Created April 24, 2020 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bikram20/6b19164a0f5437ee1df3d5ffd8a0bc85 to your computer and use it in GitHub Desktop.
Save bikram20/6b19164a0f5437ee1df3d5ffd8a0bc85 to your computer and use it in GitHub Desktop.
OCP debug commands
# Excellent site - https://openshift.tips/
# Tail 10 lines for journal log of the node. Various options.
oc adm node-log <nodename> --tail=10
oc adm node-logs ip-10-0-137-133.us-west-2.compute.internal --tail=10 -u kubelet.service
oc adm node-logs ip-10-0-137-133.us-west-2.compute.internal --tail=10 --grep=calico
# Path is w.r.t. /var/log
oc adm node-logs ip-10-0-137-133.us-west-2.compute.internal --tail=10 --path=calico/log
# To get a shell
oc debug node/ip-10-0-137-133.us-west-2.compute.internal
# Use chroot /host to run host commands e.g. iptable.
# To review kube-proxy, start with kubernetes default service under KUBE-SERVICES in nat table on any node
iptables -t nat -L KUBE-SERVICES -nv
# To run debug tools e.g. tcpdump
oc debug node/ip-10-0-149-62.us-west-2.compute.internal --image=rhel7/rhel-tools
@bikram20
Copy link
Author

bikram20 commented May 1, 2020

@bikram20
Copy link
Author

bikram20 commented May 1, 2020

Using calicoctl:

ubuntu@ip-172-31-27-26:~/gupta-bikram$ alias calicoctl='DATASTORE_TYPE=kubernetes KUBECONFIG=/home/ubuntu/<pathtokubeconfig> calicoctl'
ubuntu@ip-172-31-27-26:~/gupta-bikram$ calicoctl get node
NAME                                         
ip-10-0-128-34.us-east-2.compute.internal    
ip-10-0-136-21.us-east-2.compute.internal    
ip-10-0-145-252.us-east-2.compute.internal   
ip-10-0-146-161.us-east-2.compute.internal   
ip-10-0-166-95.us-east-2.compute.internal    
ip-10-0-171-147.us-east-2.compute.internal   

ubuntu@ip-172-31-27-26:~/gupta-bikram$ 

Instead of alias, you can use:

export CALICO_DATASTORE_TYPE=kubernetes; export KUBECONFIG=<pathtokubeconfig>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment