Skip to main content

Kubectl cheat sheet

  • Connect to container in the pod
    kubectl exec -it pod_name -c container_name bash
  • Get the list of contexts avalable in ~/.kube/config
kubectl config view
  • Get the active context.
kubectl config current-context
  • Set the context for current use
kubectl config use-context my_test_cluster
kubectl config use-context my_test_cluster --namespace
kubectl config set-context my_test_cluster --current --namespace=ggckad-s2
  • Get all the list of API reources including te short names
kubectl api-resources