Kubernetes listing resources
One of the items that needs to be learnt the process of listing items inside the environment. the kubectl get command does this. In the examples below we are working with a test cluster designated test50 and a tenant named tenant1. Note in which scenarios the namespace is specified with the -n parameter and which not.
Listing nodes
kubectl get nodes
The above lists all the nodes that are currently part of the Kubernetes cluster.
List the nodes with performance metrics can be done with the following command
kubectl top nodes
⚠️ NOTE: Memory allocation per node should never exceed 80%. This is required so that there is enough headroom for the cluster and the pods they may have to burst the available memory.
Listing namespaces
kubectl get ns
Note how the cluster name is reflected in one namespace and tenant1 in another.
Listing pods
Below is the command to do a basic listing.
kubectl -n tenant1 get pods
Below is the command to do a more advanced listing with pod IP’s and the node they reside on. Note that this is important when troubleshooting system issues as the issue can be specific to a node.
kubectl -n tenant1 get pods -o wide
NOTE: the -o is not zero but a lowercase o.
Listing pods with performance counters
kubectl -n tenant1 top pods
Listing PVC’s
kubectl -n tenant1 get pvc
Listing secrets
The command for listing secrets is the following:
kubectl -n tenant1 get secrets
List STS’s
kubectl -n tenant1 get sts
List deployments
kubectl -n tenant1 get deployments