Kubernetes Key Commands ๐
Here's a simple, visual command reference for Kubernetes lovers ๐
๐ ๏ธ Cluster Management
- ๐
kubectl cluster-info
โ Show cluster details - โ๏ธ
kubectl config
โ Manage kubeconfig - ๐งช
kubectl version
โ Show client/server version - ๐งฑ
kubectl get nodes
โ List all nodes - ๐ฆ
kubectl get pods
โ List pods across cluster - ๐
kubectl get services
โ List all services
๐ฆ Pod Management
- ๐
kubectl create pod
โ Create a new pod - ๐
kubectl get pods
โ Show all pods - ๐ง
kubectl describe pod
โ Inspect pod details - ๐
kubectl logs
โ View pod logs - ๐ป
kubectl exec -it
โ Open a shell in the pod-- bash - โ
kubectl delete pod
โ Delete a pod
๐ Resource Monitoring
- ๐
kubectl top nodes
โ Node metrics - ๐
kubectl top pods
โ Pod metrics - ๐งฎ
kubectl get quota
โ Resource quota info - ๐
kubectl describe
โ Describe any resource
๐ Service Management
- ๐
kubectl create service
โ Start a new service - ๐
kubectl get services
โ Show services - ๐ข
kubectl expose pod
โ Expose a pod as a service - ๐
kubectl describe service
โ Inspect a service - โ
kubectl delete service
โ Remove a service - ๐
kubectl port-forward
โ Forward local port to a pod8080:80
๐ Config & Secrets
- ๐งพ
kubectl create configmap
โ Make a configmap - ๐
kubectl get configmaps
โ List all configmaps - ๐งช
kubectl create secret
โ Create a secret - ๐ง
kubectl get secrets
โ Show secrets - ๐งต
kubectl describe configmap
โ Configmap details - ๐
kubectl describe secret
โ Secret info
๐ Deployment Management
- ๐ง
kubectl create deployment
โ Start a deployment - ๐
kubectl get deployments
โ List all deployments - ๐
kubectl scale deployment
โ Scale deployment--replicas=3 - ๐
kubectl rollout status deployment/
โ Check rollout - ๐
kubectl rollout history deployment/
โ View rollout history - ๐งจ
kubectl delete deployment
โ Remove a deployment
๐๏ธ Namespace Management
- ๐
kubectl create namespace
โ New namespace - ๐
kubectl get namespaces
โ List all namespaces - ๐งพ
kubectl describe namespace
โ Inspect a namespace - โ
kubectl delete namespace
โ Delete a namespace - ๐ฅ
kubectl apply -n
โ Apply to a namespace-f app.yaml - ๐
kubectl config set-context --current --namespace=
โ Switch default namespace
๐ฏ Use this cheat sheet daily or save it for quick access when working with Kubernetes!