In access-limited clusters where you don’t have access to cluster resources, you may need worker nodes’ info like worker node name, node IP address, etc. You can’t run kubectl get nodes in such clusters because the cluster admin has restricted your access to only particular namespaces and namespaced resources. This trick is for you if you are blocked in such a situation. First, you must run the following DaemonSet to ensure you have a Pod in every worker node to be able to find worker nodes’ info.

Follow our social media:

After that, run the following command to see all nodes’ names and IP addresses.

kubectl get pod -l app=test -o jsonpath='{range .items[*]}{.spec.nodeName}{"\t"}{.status.hostIP}{"\n"}{end}'

If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.

Follow my LinkedIn

Follow Kubedemy LinkedIn

Follow Kubedemy Telegram

Leave a Reply

Your email address will not be published. Required fields are marked *