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!