DEV Community

John  Ajera
John Ajera

Posted on

1

Kubernetes Key Commands

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!

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil โ€” patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

ACI image

ACI.dev: The Only MCP Server Your AI Agents Need

ACI.devโ€™s open-source tool-use platform and Unified MCP Server turns 600+ functions into two simple MCP tools on one serverโ€”search and execute. Comes with multi-tenant auth and natural-language permission scopes. 100% open-source under Apache 2.0.

Star our GitHub!

๐Ÿ‘‹ Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spiritsโ€”leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay