Skip to content
- Namespaces
- List all namespaces:
kubectl get namespace
- Set a namespace:
kubens <namespace-name>
- See currently set namespace: kubens -c
- Pods
- List all pods:
kubectl get pods
- List all pods in specific namespace:
kubectl get pods -n <namespace>
- Kill a pod:
kubectl delete pod <pod-name>
- Describe/get details of pod:
kubectl describe pods <pod-name>
- InitContainers
- Get logs: First describe the pod and look for the name of the init container. Then run
kubectl logs <pod-name> -c <init-container-name>
- Deployments
- Get the manifest for a deployment:
kubectl get deploy <deployment-name> -o yaml
- Scaling a deployment:
kubectl scale --replicas=<n> deployment/<deployment-name>
- Gen env vars defined on a pod:
kubectl exec <pod> -- env
- ConfigMaps
- View data in a ConfigMap:
kubectl describe configmaps <name>