On the pathway to prepare us for the exam CKA (Certified Kubernetes Administrator), I decided to create a list of exercises that it can be helpful to practice with hand-on approach in your on lab of some commands and tasks. 

Exercise:

After you finish to deploy your cluster. We will proceed with these tasks:

  • list all the nodes
  • list all the namespaces in the cluster
  • list all the pods in all namespaces
  • list all the pods in one of namespace (choose one)
  • list all the services in that namespace
  • list all the pods showing name and namespace with a json path expression

Solution:

kubectl get nodes

kubectl get namespaces
kubectl get ns
kubectl get po --all-namespaces

kubectl get po -n kube-system
kubectl get svc -n kube-system
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'metadata.namespace']}"

Brando Sabatini and Ikbal C ©. Powered by Blogger.