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 -- bash โ€“ Open a shell in the pod
  • โŒ 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 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 โ€“ Configmap details
  • ๐Ÿ”‘ kubectl describe secret โ€“ Secret info

๐Ÿš€ Deployment Management

  • ๐Ÿšง kubectl create deployment โ€“ Start a deployment
  • ๐Ÿ“‹ kubectl get deployments โ€“ List all deployments
  • ๐Ÿ“Š kubectl scale deployment --replicas=3 โ€“ Scale deployment
  • ๐Ÿ”„ 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 -f app.yaml โ€“ Apply to a namespace
  • ๐Ÿ” kubectl config set-context --current --namespace= โ€“ Switch default namespace

๐ŸŽฏ Use this cheat sheet daily or save it for quick access when working with Kubernetes!