Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 837 Bytes

k8s.md

File metadata and controls

16 lines (14 loc) · 837 Bytes

Kubernetes Cheatsheet

Authentication & Switching Clusters

  • gcloud container clusters get-credentials <cluster_name> Add cluster to config
  • kubectl config use-context switch context
  • kubectl config current-context get name of current context
  • kubectl config get-clusters list all k8s clusters currently in config file
  • kubectl config get-contexts list all contexts, showing active context too
  • kubectl config rename-context <ugly_long_name> <shortName> Rename context name for easier switching

Pods

  • kubectl describe pod <pod id> Get info on pod
  • kubectl exec -it <pod id> -- /bin/bash SSH into pod
  • kubectl create -f https://k8s.io/examples/application/shell-demo.yaml create pod
  • kubectl get pod shell-demo get pod info
  • kubectl exec -it shell-demo -- /bin/bash get shell into running container