Github CrashCourse Flashcards
How to run an actual shell on a pod container?
kubectl exec mypod -it – /bin/sh
How to get IP Address of pod?
kubectl describe mypod
OR
kubectl get pods -o wide
How to run temporary pod interactively?
kubectl run busybox –image=busybox –rm -it –restart=Never -n ckad-prep – /bin/sh
kubectl interactive flag?
-it
kubectl temporary flag?
–rm
2 types of secret?
data, stringData
location of service account token?
/var/run/secrets/kubernetes.io/serviceaccount
how to set namespace of pod?
either within manifest file of pod OR via -n flag of kubectl apply
how to make a pod named ‘backend’ with serviceaccount called ‘backend-team’?
kubectl run backend –image=nginx –restart=Never –serviceaccount=backend-team
how to make a serviceaccount named ‘backend-team’?
kubectl create serviceaccount backend-team
flag to not restart when using ‘run’ command?
–restart=Never
how to ssh into a single container of multi-container pod?
–container=containerName
how to show labels AND specify more than one label?
kubectl get pods -l ‘team in (shiny, legacy)’,env=prod –show-labels