I have been learning k8s for several months. Some scripts I have been using quite often.
Here comes the GitHub repo: kubernetes-scripts.
(Hint: Learn kubernetes by real scenarios? check challenges-kubernetes repo.)
Some scripts quoted from GitHub.
- listpodswithnode.sh: List all pods with node name attached.
For debugging purpose, you might want to know which node runs a given pod.
- findpodbyip.sh: Find pods by pod ip.
You might run into similar errors like below, Right? Request fails with some tcp endpoint.
,----------- | root@k8s1:~# curl http://localhost:8001/api/... | Error: 'dial tcp 172.17.0.2:8443: getsockopt: no route to host' | Trying to reach: 'https://172.17.0.2:8443/' `-----------
It says: no route to host. Should be some network issue. But who holds the ip of 172.17.0.2?
Want to identity the pod with one command? Try the script in GitHub.
Want to check more? Everything is in GitHub.
If you find the repo useful or interesting, please remember to star or fork it. Cheers!
More Reading:
Blog URL: https://www.dennyzhang.com/kubernetes-scripts