Useful commands during Kubernetes certification (CKA,CKAD)

Know the shortcuts

Kubernetes certification is basically a practical scanrios-based exam. Creating shortcuts would help you to save a lot of time.

Create your alias:


To list all the pods in the default namespace

kubectl get pods => k get pods

Know the API resources’ short names


pod = po
cronjob = cj
namespace = ns
deployment = deploy
service = svc
persistent volume = pv
persistent volume claim = pvc

Get all the short names, By running the get api-resource

kubectl api-resources -o wide
NAME                              SHORTNAMES     APIGROUP                       NAMESPACED   KIND                             VERBS
configmaps                        cm                                            true         ConfigMap                        [create delete deletecollection get list patch update watch]

Now, You can further trim your command as below

kubectl get pods => k get pods => k get po

Easy way to create Yaml files

For example: If you are required to create a pod with image=nginx + a few more tasks, Then we can jump-start the creation as below

kubectl run <podname> —image=nginx —restart=never —dry-run=client -o yaml > pod-definition.yaml

The above command would create a YAML file with a preloaded definition and all you have to do is to add elements based on the given task

To get a definition of already running pod

kubectl get <podname> -o yaml > pod-definition.yaml

By knowing the above shortcuts you can reduce the time spent on typing and instead use it to solve the problem

Check out here for other Kubernetes learning post

Good luck with your learning, Hit like if this post is helpful

Similar Posts