Register to Better Coder! It's free.
Enjoy the premium features and succeed at every job interview.

You are looking for IP address details of your Kubernetes nodes, but you are not sure what is a structure of node manifests. How can you find this details and learn more about the structure?

Experience Level: Medior
Tags: Kubernetes

Answer

Run the following command:

kubectl get node -o yaml|grep --ignore-case --context=10 ip

How it works?

  • Using kubectl, details of nodes are displayed in yaml format
  • Using grep command, rows are searched for string ip (case insensitive search), besides the row, block of 10 rows before and 10 rows after is displayed
  • This allows you to quickly find key blocks in manifests when you don't know exactly what you are looking for. Based on the output you can further refine the query.
Kubernetes Certified Application Developer (CKAD) preparation
Kubernetes Certified Application Developer (CKAD) preparation

Are you learning Kubernetes ? Try our test we designed to help you progress faster.

Test yourself
Kubernetes
Kubernetes

Are you learning Kubernetes ? Try our test we designed to help you progress faster.

Test yourself
25 Kubernetes questions that will help you get certified and become more efficient with K8s
25 Kubernetes questions that will help you get certified and become more efficient with K8s

Are you learning Kubernetes ? Try our test we designed to help you progress faster.

Test yourself