SASERÁ Academy
Certified Kubernetes Application Developer · kubectl cheat sheet

The CKAD kubectl cheat sheet: imperative commands for v1.37

The commands and flags that save minutes on a hands-on exam: generate YAML, create config objects, change running apps, roll out and back, expose, grant access and debug. Every flag below is in the Kubernetes v1.37 kubectl reference or the Helm documentation. Print it or save it as a PDF for practice.

v1.37Kubernetes version
kkubectl alias on exam hosts
15-20hands-on tasks
2 hexam time
CKAD practice exams course cover

The real CKAD is hands-on. You solve 15-20 tasks on the command line, in live Kubernetes clusters, in 2 hours. There is no multiple choice on it. These questions are multiple-choice practice: they train the decisions inside those tasks (which command, which YAML field, which clue in the output), and you should also type them in a real cluster.

1. Generate YAML instead of typing it

TaskCommand
Pod manifest to editkubectl run web --image=nginx:1.27 --port=80 --dry-run=client -o yaml > pod.yaml
Pod with env, labels and a commandkubectl run job1 --image=busybox:1.36 --restart=Never --env=MODE=batch --labels=app=job1 --command -- sleep 3600
Throwaway test Podkubectl run tmp --image=busybox:1.36 --rm -it --restart=Never -- wget -qO- http://web:80
Deployment with replicas and portkubectl create deployment api --image=registry.example.com/api:2.1 -r 3 --port=8080 --dry-run=client -o yaml > deploy.yaml
Jobkubectl create job report --image=busybox:1.36 -- echo done
Run a CronJob nowkubectl create job report-now --from=cronjob/report
CronJobkubectl create cronjob report --image=busybox:1.36 --schedule="*/5 * * * *" -- echo done
Apply, then check without changingkubectl apply -f deploy.yaml · kubectl apply -f deploy.yaml --dry-run=server
Look up a fieldkubectl explain deployment.spec.strategy · kubectl explain pods --recursive

Work in the task's namespace: add -n NAMESPACE to every command, or switch with kubectl config set-context --current --namespace=NAMESPACE.

2. ConfigMaps, Secrets, ServiceAccounts, quotas

TaskCommand
ConfigMap from literalskubectl create configmap app-cfg --from-literal=MODE=prod --from-literal=LOG=info
ConfigMap from fileskubectl create configmap app-cfg --from-file=app.properties · --from-env-file=app.env
Generic Secretkubectl create secret generic db --from-literal=user=app --from-literal=password=s3cret
TLS Secretkubectl create secret tls web-tls --cert=tls.crt --key=tls.key
Registry Secret for imagePullSecretskubectl create secret docker-registry regcred --docker-server=registry.example.com --docker-username=ci --docker-password=$TOKEN
ServiceAccount and a tokenkubectl create serviceaccount build-bot · kubectl create token build-bot --duration=1h
ResourceQuotakubectl create quota team-q --hard=cpu=2,memory=2Gi,pods=10

Secret values in data are only base64-encoded, and Secrets are stored unencrypted in etcd by default. stringData takes plain text.

3. Change running applications

TaskCommand
New imagekubectl set image deployment/api api=registry.example.com/api:2.2
Environment from a ConfigMap or Secretkubectl set env deployment/api --from=configmap/app-cfg · --from=secret/db
Requests and limitskubectl set resources deployment/api -c api --requests=cpu=100m,memory=128Mi --limits=cpu=500m,memory=256Mi
ServiceAccountkubectl set serviceaccount deployment/api build-bot
Scalekubectl scale deployment/api --replicas=5
Labelskubectl label pod web tier=frontend · kubectl label pod web tier=backend --overwrite
Switch a Service selector (blue/green)kubectl patch service shop -p '{"spec":{"selector":{"app":"shop","version":"green"}}}'

4. Rollouts

TaskCommand
Watch a rollout (exits non-zero if it fails)kubectl rollout status deployment/api
History, and one revision's templatekubectl rollout history deployment/api · kubectl rollout history deployment/api --revision=2
Roll backkubectl rollout undo deployment/api · kubectl rollout undo deployment/api --to-revision=2
Restart Pods without changing the speckubectl rollout restart deployment/api
Batch several changes into one rolloutkubectl rollout pause deployment/api … changes … kubectl rollout resume deployment/api

Defaults worth knowing: maxSurge and maxUnavailable are 25%, revisionHistoryLimit is 10, and scaling does not create a new revision.

5. Services, Ingress and access

TaskCommand
Expose a Deploymentkubectl expose deployment api --port=80 --target-port=8080 --name=api-svc
NodePort Servicekubectl expose deployment api --port=80 --target-port=8080 --type=NodePort
ClusterIP Service by handkubectl create service clusterip api --tcp=80:8080
Ingress with a Prefix pathkubectl create ingress shop --class=nginx --rule="shop.example.com/api*=api:8080"
Ingress with TLSkubectl create ingress shop --class=nginx --rule="shop.example.com/*=web:80,tls=web-tls"
Check endpoints behind a Servicekubectl get endpointslices -l kubernetes.io/service-name=api
Reach a Service from your terminalkubectl port-forward service/api 8080:80

In --rule, a path ending in * becomes pathType: Prefix. targetPort defaults to port. NetworkPolicies have no imperative command: write the YAML.

6. RBAC

TaskCommand
Role that only reads Podskubectl create role pod-reader --verb=get,list,watch --resource=pods
Bind it to a ServiceAccountkubectl create rolebinding pod-reader-bot --role=pod-reader --serviceaccount=shop-prod:build-bot
Bind a ClusterRole in one namespacekubectl create rolebinding view-bot --clusterrole=view --serviceaccount=shop-prod:build-bot
Test a permission as the ServiceAccountkubectl auth can-i list pods --as=system:serviceaccount:shop-prod:build-bot -n shop-prod
List what you can dokubectl auth can-i --list

A Role holds rules; subjects are attached separately with a RoleBinding. A binding's roleRef cannot be changed: delete and recreate it.

7. Observe and debug

TaskCommand
Pods with node, IP and labelskubectl get pods -o wide --show-labels · kubectl get pods -L version
Only Pods that are not Runningkubectl get pods --field-selector=status.phase!=Running
Name and image of every Podkubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
Events for one objectkubectl events --for pod/web · kubectl describe pod web
Logs of the crashed containerkubectl logs web -c api --previous
Last lines with timestampskubectl logs web -c api --tail=20 --timestamps
Logs from every Pod of an appkubectl logs -l app=api --all-containers
CPU and memory per containerkubectl top pod web --containers
Shell in one containerkubectl exec -it web -c api -- sh
Debug a distroless containerkubectl debug -it web --image=busybox:1.36 --target=api
Debug a copy of the Podkubectl debug web -it --image=busybox:1.36 --copy-to=web-debug
Which API versions are servedkubectl api-resources --api-group=apps · kubectl api-versions

kubectl top needs the Metrics API. -l on kubectl logs shows only the last 10 lines per Pod unless you set --tail.

8. Kustomize and Helm

TaskCommand
Render an overlaykubectl kustomize overlays/prod
Apply or compare an overlaykubectl apply -k overlays/prod · kubectl diff -k overlays/prod
Add and refresh a chart repositoryhelm repo add myrepo https://charts.example.com · helm repo update
Find chart versions and defaultshelm search repo myrepo/nginx --versions · helm show values myrepo/nginx
Install a pinned versionhelm install web myrepo/nginx -n web --create-namespace --version 1.2.3 -f values.yaml --set replicaCount=2
Upgrade keeping earlier valueshelm upgrade web myrepo/nginx -n web --reuse-values --set image.tag=1.27
History and rollbackhelm history web -n web · helm rollback web 2 -n web
Releases and their valueshelm list -n web · helm list -A · helm get values web -n web --all
Render or download without installinghelm template web myrepo/nginx · helm pull myrepo/nginx --untar
Remove a releasehelm uninstall web -n web

The Helm version on the exam hosts is not published, so these are commands that work the same in Helm 3 and Helm 4. Avoid flags that changed in Helm 4: --atomic (now --rollback-on-failure), --force (now --force-replace) and --wait with a value. Repository URL and versions are examples.

9. Traps: commands that do not work in v1.37

Old habitWhat happensUse instead
kubectl run web --image=nginx --replicas=3kubectl run has no --replicas; it creates Pods onlykubectl create deployment web --image=nginx -r 3
kubectl run ... --serviceaccount=botNo such flag in v1.37serviceAccountName in the YAML, or kubectl set serviceaccount on a Deployment
kubectl run ... --requests=... --limits=...No such flags in v1.37kubectl set resources, or edit the generated YAML
kubectl run -f pod.yamlDeprecated in v1.37kubectl apply -f pod.yaml
kubectl convert -f old.yamlNot part of kubectl; it is the separate kubectl-convert pluginRewrite to the served API version, checked with kubectl explain
kubectl create secret regcred --docker-server=...Missing the Secret typekubectl create secret docker-registry regcred ...
apiVersion: batch/v1beta1 CronJob, networking.k8s.io/v1beta1 IngressNo longer servedbatch/v1 and networking.k8s.io/v1
Practice with 10 free questions: 10 free CKAD practice questions. Every option is explained, right or wrong. Four of them ask you to pick the right command, with the traps above among the options.

360 questions on the decisions behind CKAD tasks

Six timed multiple-choice exams for a hands-on exam: 94 command questions, 116 manifests and 53 debugging exhibits on Kubernetes v1.37, every option explained.

See the CKAD course →

CKAD cheat sheet FAQ

Is there a CKAD cheat sheet PDF?

Use this page: press the print button and choose Save as PDF. You cannot bring it into the exam, where only the Kubernetes docs, the Kubernetes blog, the Helm docs and task-linked docs are allowed; it is for practice.

Which kubectl flags no longer work?

In Kubernetes v1.37, kubectl run has no --replicas, --serviceaccount, --requests, --limits or --generator. Use kubectl create deployment -r for replicas, kubectl set serviceaccount and kubectl set resources instead. kubectl convert is a separate plugin.

Why use imperative commands on the CKAD?

The CKAD is hands-on: 15-20 tasks in live clusters in 2 hours, with no multiple choice. Generating YAML with --dry-run=client -o yaml and editing it is much faster than typing a manifest from scratch, and less error-prone.

Which Helm commands are safe to learn?

The Helm version on the exam hosts is not published, so learn commands that work the same in Helm 3 and Helm 4: repo add and update, search repo, show values, install, upgrade, history, rollback, list, get values, template, pull and uninstall.

More guides: Free CKAD practice questions · CKAD exam format 2026 · CKA vs CKAD · Free Terraform Associate 004 questions · all guides