Hello!
Since I'm a Kube beginner, I gradually started writing this memory aid.
It's not exhaustive at all, but it's a start :)
I hope it helps.
You'll need this alias for all the listed cmd: alias k='kubectl'
Contexts
List contexts (and show the current one)
k config get-contexts
Switch context
k config use-context <CONTEXT_NAME>
Pods
List pods
k get pod
Delete a pod
k delete pod <POD-ID>
Show pod details (and the events linked to the pod)
k describe pod <POD-ID>
Download a file from a pod
k cp <POD-ID>:<POD_FILE_PATH> <LOCAL_PATH>
Containers
Connect to a container using sh
or bash
k exec -it <POD-ID> -c <CONTAINER-NAME> <sh|bash>
Logs
Show logs of a container
k logs <POD-ID> <CONTAINER-NAME> -f
Show all the logs of a deployment
k logs -f deployment/<DEPLOYMENT-NAME> --all-containers=true
Events
List events sorted by timestamp
k get event --sort-by .lastTimestamp
Secrets
Show secrets with age
k get externalsecrets
Deploys
List deploys on a cluster
k get deploy
List deploys on a cluster, with details
kubectl get deploy -o=custom-columns=NAME:.metadata.name,STATUS:.status.phase,VERSION:.metadata.labels.version
Show deploy status
k rollout status deploy/<DEPLOY-NAME>
Scale
Define the number of replicas
k scale deploy/<DEPLOY-NAME> --replicas=2
Show replicas sets
k get rs
Cron
Show cron jobs
k get cronjobs
Top comments (0)