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)