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!