Loading…
Loading…
Shell set-up, aliases and the kubectl commands you reach for most in CKA and CKAD tasks, grouped by topic.
Loading…
The lines worth typing before the first question.
No exam-day lines are approved yet.
Every alias our labs may load. Guided labs load them all; exam-style labs load none.
No aliases are approved yet.
kubectl run web --image=nginx --port=80kubectl run web --image=nginx --dry-run=client -o yaml > web.yamlkubectl run box --image=busybox --labels=app=box,tier=tools -- sleep 3600kubectl exec -it web -- shkubectl replace --force -f web.yamlkubectl create deployment api --image=nginx --replicas=3kubectl scale deployment api --replicas=5kubectl set image deployment/api nginx=nginx:1.27kubectl rollout status deployment/api
kubectl rollout undo deployment/apikubectl rollout history deployment/apikubectl expose deployment api --port=80 --target-port=8080kubectl expose deployment api --type=NodePort --port=80kubectl expose pod web --port=80 --name=web-svckubectl get endpointslices -l kubernetes.io/service-name=apikubectl create configmap app-config --from-literal=MODE=prod --from-literal=LEVEL=infokubectl create configmap nginx-conf --from-file=nginx.confkubectl create secret generic db --from-literal=user=app --from-literal=password=s3cretkubectl get secret db -o jsonpath='{.data.password}' | base64 -dkubectl create job hello --image=busybox -- echo hellokubectl create cronjob tick --image=busybox --schedule='*/5 * * * *' -- datekubectl create job tick-now --from=cronjob/tickkubectl create serviceaccount appkubectl create role pod-reader --verb=get,list,watch --resource=podskubectl create rolebinding app-reads --role=pod-reader --serviceaccount=default:appkubectl auth can-i list pods --as=system:serviceaccount:default:appkubectl run tmp --rm -it --image=busybox --restart=Never -- wget -qO- http://apikubectl run tmp --rm -it --image=busybox --restart=Never -- nslookup api.default.svc.cluster.localkubectl get networkpolicy -n team-akubectl port-forward svc/api 8080:80kubectl describe pod webkubectl logs web --previouskubectl logs web -c sidecarkubectl get events --sort-by=.lastTimestampkubectl describe node node-1
sudo journalctl -u kubelet --since '10 min ago'kubectl get pods -o widekubectl get pod web -o jsonpath='{.status.podIP}'kubectl get pods -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeNamekubectl get pods --sort-by=.metadata.creationTimestampkubectl get pods --show-labelshelm repo add bitnami https://charts.bitnami.com/bitnami
helm repo updatehelm install web bitnami/nginx --set replicaCount=2 -n web --create-namespacehelm list -Ahelm upgrade web bitnami/nginx --set replicaCount=3 -n web
helm rollback web 1 -n web