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 <pod>
โ Inspect pod details - ๐
kubectl logs <pod>
โ View pod logs - ๐ป
kubectl exec -it <pod> -- bash
โ Open a shell in the pod - โ
kubectl delete pod <pod>
โ Delete a pod
๐ Resource Monitoring
- ๐
kubectl top nodes
โ Node metrics - ๐
kubectl top pods
โ Pod metrics - ๐งฎ
kubectl get quota
โ Resource quota info - ๐
kubectl describe <resource>
โ Describe any resource
๐ Service Management
- ๐
kubectl create service
โ Start a new service - ๐
kubectl get services
โ Show services - ๐ข
kubectl expose pod <pod>
โ Expose a pod as a service - ๐
kubectl describe service <svc>
โ Inspect a service - โ
kubectl delete service <svc>
โ Remove a service - ๐
kubectl port-forward <pod> 8080:80
โ Forward local port to a pod
๐ 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 <name>
โ Configmap details - ๐
kubectl describe secret <name>
โ Secret info
๐ Deployment Management
- ๐ง
kubectl create deployment
โ Start a deployment - ๐
kubectl get deployments
โ List all deployments - ๐
kubectl scale deployment <name> --replicas=3
โ Scale deployment - ๐
kubectl rollout status deployment/<name>
โ Check rollout - ๐
kubectl rollout history deployment/<name>
โ View rollout history - ๐งจ
kubectl delete deployment <name>
โ Remove a deployment
๐๏ธ Namespace Management
- ๐
kubectl create namespace <name>
โ New namespace - ๐
kubectl get namespaces
โ List all namespaces - ๐งพ
kubectl describe namespace <name>
โ Inspect a namespace - โ
kubectl delete namespace <name>
โ Delete a namespace - ๐ฅ
kubectl apply -n <namespace> -f app.yaml
โ Apply to a namespace - ๐
kubectl config set-context --current --namespace=<name>
โ Switch default namespace
๐ฏ Use this cheat sheet daily or save it for quick access when working with Kubernetes!
Top comments (0)