Kubernetes Key Commands
John  Ajera

John Ajera @jajera

About: Platform Engineer

Location:
Wellington, New Zealand
Joined:
Nov 20, 2024

Kubernetes Key Commands

Publish Date: Apr 13
1 0

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!

Comments 0 total

    Add comment