Kubernetes 101 : Some practical and useful Kubernetes commands - JSONPATH, --field-selector, ... -



If you are a kubernetes cluster administrator for example and you want to run a command as another user/account, you could use the below command:


To display only the running pods in the default namespace, we could use the below command:


To see the  running pods in a specific namespace, we could add the "-n namespace_name" parameter.

To see the pods that are running on a particular node, we could use the below command:


To display the pods in a particular namespace, we could use:


To list all the pods, we use the below command:


To get the Yaml configuration file of a pod, so that we could alter it and re-apply the changes, we could use the below command:


Pods, when they fail, they get restarted. We could list the pods and their restart attempts using the below command:


To get the IP address of a pod in a specific namespace, we could use the below command:


We could also list all the persistent volumes and their capacity using the below command:


To list all the worker nodes, we list all the nodes except the ones with the "node-role.kubernetes.io/master" label which is reserved for the master nodes:


To see the "ready" nodes that are have the "Ready" parameter set as "True", we use a the below JSONPATH template:


Then we can apply the above JASONPATH template to our search as follows:

Comments

Leave as a comment:

Archive