Created
April 24, 2020 07:37
-
-
Save bikram20/6b19164a0f5437ee1df3d5ffd8a0bc85 to your computer and use it in GitHub Desktop.
OCP debug commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
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
Pod network/policy troubleshooting:
https://medium.com/@bikramgupta/pod-network-troubleshooting-while-using-calico-on-kubernetes-ee78b731d4d8