Why This Kubectl Cheat Sheet is Different

Welcome to the most comprehensive kubectl cheat sheet designed specifically for platform engineers, DevOps teams, and Kubernetes practitioners in 2026. Unlike traditional cheat sheets that simply list commands, this guide is organized by real-world scenarios you encounter daily.

What Makes This Guide Unique:
  • Scenario-Based Organization — Commands grouped by actual use cases
  • Difficulty Levels — Beginner, Intermediate, and Advanced sections
  • Pro Tips & Gotchas — Expert insights you won't find in docs
  • Troubleshooting Workflows — Complete debugging sequences
  • Performance Best Practices — When and why to use each command

Installation & Setup

Installing kubectl

# macOS (via Homebrew)
brew install kubectl

# Linux (via curl)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

# Windows (via Chocolatey)
choco install kubernetes-cli

# Verify installation
kubectl version --client

Configuring kubectl Context

# View current context
kubectl config current-context

# List all contexts
kubectl config get-contexts

# Switch context
kubectl config use-context <context-name>

# Set default namespace for current context
kubectl config set-context --current --namespace=<namespace>

# View full kubeconfig
kubectl config view
Pro Tip: Use kubectx and kubens for faster context and namespace switching. Install via: brew install kubectx

Cluster Information & Context

Scenario: You need to inspect cluster health and get basic information

# Get cluster information
kubectl cluster-info

# Get cluster nodes with detailed info
kubectl get nodes -o wide

# Describe a specific node
kubectl describe node <node-name>

# Check control plane readiness (componentstatuses is deprecated)
kubectl get --raw='/readyz?verbose'

# Check API server health
kubectl get --raw /healthz

# View cluster events
kubectl get events --all-namespaces --sort-by='.lastTimestamp'

Resource Discovery

# List all resource types in cluster
kubectl api-resources

# List all resources in current namespace
kubectl get all

# List all resources across all namespaces
kubectl get all --all-namespaces

# Get API versions supported by the cluster
kubectl api-versions

# Explain a resource type
kubectl explain pods
kubectl explain pod.spec.containers

Pod Management & Debugging

These are the commands; for a complete step-by-step workflow from Pending to CrashLoopBackOff, see how to debug Kubernetes pods.

Scenario: Your application pods are crashing, and you need to debug them

# List all pods in current namespace
kubectl get pods

# List pods with more details (IP, Node, etc.)
kubectl get pods -o wide

# Watch pods in real-time
kubectl get pods --watch

# Get pods by label
kubectl get pods -l app=nginx

# Get pods from all namespaces
kubectl get pods --all-namespaces

# Describe a pod (shows events, volumes, conditions)
kubectl describe pod <pod-name>

# Get pod logs
kubectl logs <pod-name>

# Get logs from previous crashed container
kubectl logs <pod-name> --previous

# Stream logs in real-time
kubectl logs -f <pod-name>

# Get logs from specific container in multi-container pod
kubectl logs <pod-name> -c <container-name>

# Get logs with timestamps
kubectl logs <pod-name> --timestamps=true

# Get last 100 lines of logs
kubectl logs <pod-name> --tail=100

# Get logs from last 1 hour
kubectl logs <pod-name> --since=1h
Pro Tip: When debugging crashes, always check both current and previous logs: kubectl logs <pod> --previous. This shows you what happened before the restart.

Interactive Debugging

# Execute command in a running pod
kubectl exec <pod-name> -- <command>

# Get shell access to a pod
kubectl exec -it <pod-name> -- /bin/bash
kubectl exec -it <pod-name> -- /bin/sh

# Execute in specific container (multi-container pod)
kubectl exec -it <pod-name> -c <container-name> -- /bin/bash

# Copy files to/from pod
kubectl cp <local-file> <pod-name>:/path/to/destination
kubectl cp <pod-name>:/path/to/file <local-destination>

# Port forward to access pod locally
kubectl port-forward <pod-name> 8080:80

# Port forward for a deployment
kubectl port-forward deployment/<deployment-name> 8080:80

Scenario: Create temporary debug pod in the same network namespace

# Create ephemeral debug container (K8s 1.23+)
kubectl debug <pod-name> -it --image=busybox --target=<container-name>

# Debug with different image
kubectl debug <pod-name> -it --image=nicolaka/netshoot

# Create debug pod on specific node
kubectl debug node/<node-name> -it --image=ubuntu

# Run temporary pod for debugging
kubectl run debug-pod --rm -it --image=busybox -- sh

Pod Management

# Create a pod imperatively
kubectl run nginx --image=nginx:latest

# Create pod with specific labels
kubectl run nginx --image=nginx --labels="app=nginx,env=prod"

# Create pod and expose it as a service
kubectl run nginx --image=nginx --port=80 --expose

# Delete a pod
kubectl delete pod <pod-name>

# Delete all pods with label
kubectl delete pods -l app=nginx

# Force delete a stuck pod
kubectl delete pod <pod-name> --grace-period=0 --force

# Delete all pods in current namespace
kubectl delete pods --all
Warning: Never use --force --grace-period=0 in production unless absolutely necessary. This can lead to data loss and orphaned resources.

Deployments & Scaling

Scenario: Deploy and scale your application

# Create a deployment
kubectl create deployment nginx --image=nginx:latest

# Create deployment with replicas
kubectl create deployment nginx --image=nginx:latest --replicas=3

# Scale deployment
kubectl scale deployment nginx --replicas=5

# Autoscale deployment (HPA)
kubectl autoscale deployment nginx --cpu-percent=70 --min=2 --max=10

# Update deployment image (rollout)
kubectl set image deployment/nginx nginx=nginx:1.21

# View rollout status
kubectl rollout status deployment/nginx

# View rollout history
kubectl rollout history deployment/nginx

# Rollback to previous version
kubectl rollout undo deployment/nginx

# Rollback to specific revision
kubectl rollout undo deployment/nginx --to-revision=2

# Pause rollout
kubectl rollout pause deployment/nginx

# Resume rollout
kubectl rollout resume deployment/nginx

# Restart deployment (recreate all pods)
kubectl rollout restart deployment/nginx
Pro Tip: Always use kubectl rollout status after deployment updates in CI/CD pipelines. Add --timeout=5m to fail fast if rollout takes too long.

Deployment Management

# Get all deployments
kubectl get deployments

# Get deployment with details
kubectl describe deployment <deployment-name>

# Edit deployment in-place
kubectl edit deployment <deployment-name>

# Export deployment YAML
kubectl get deployment <deployment-name> -o yaml > deployment.yaml

# Delete deployment
kubectl delete deployment <deployment-name>

# View deployment resource usage
kubectl top deployment <deployment-name>

Scenario: Zero-downtime deployment with careful rollout

# Update with custom rollout strategy
kubectl patch deployment nginx -p '{"spec":{"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxSurge":1,"maxUnavailable":0}}}}'

# Set deployment annotations for change tracking
kubectl annotate deployment nginx kubernetes.io/change-cause="Updated to nginx 1.21"

# Watch pod updates during rollout
kubectl get pods -l app=nginx --watch

# Verify all replicas are ready
kubectl wait --for=condition=available --timeout=300s deployment/nginx

Services & Networking

Scenario: Expose your application and debug network connectivity

# Create ClusterIP service (default)
kubectl expose deployment nginx --port=80 --target-port=80

# Create NodePort service
kubectl expose deployment nginx --type=NodePort --port=80

# Create LoadBalancer service
kubectl expose deployment nginx --type=LoadBalancer --port=80

# Get all services
kubectl get services
kubectl get svc

# Describe service
kubectl describe service nginx

# Get service endpoints
kubectl get endpoints nginx

# Test service DNS resolution from pod
kubectl run debug --rm -it --image=busybox -- nslookup nginx.default.svc.cluster.local

# Test service connectivity
kubectl run debug --rm -it --image=nicolaka/netshoot -- curl http://nginx

Ingress Management

# Get all ingress resources
kubectl get ingress

# Describe ingress
kubectl describe ingress <ingress-name>

# Get ingress with details
kubectl get ingress <ingress-name> -o yaml

# Test ingress from within cluster
kubectl run debug --rm -it --image=curlimages/curl -- curl -H "Host: example.com" http://<ingress-controller-ip>
Pro Tip: Use kubectl get svc -o wide --all-namespaces | grep LoadBalancer to quickly find all externally exposed services and their IPs.

Network Policies

# Get network policies
kubectl get networkpolicies
kubectl get netpol

# Describe network policy
kubectl describe networkpolicy <policy-name>

# Test network policy (requires network policy debugging tools)
kubectl run source-pod --rm -it --image=busybox -- wget -O- http://target-service

ConfigMaps & Secrets

ConfigMaps

# Create ConfigMap from literal values
kubectl create configmap app-config \
  --from-literal=APP_ENV=production \
  --from-literal=LOG_LEVEL=info

# Create ConfigMap from file
kubectl create configmap app-config --from-file=config.properties

# Create ConfigMap from directory
kubectl create configmap app-config --from-file=./config-dir/

# Create ConfigMap from env file
kubectl create configmap app-config --from-env-file=.env

# Get ConfigMaps
kubectl get configmaps
kubectl get cm

# Describe ConfigMap
kubectl describe configmap app-config

# View ConfigMap data
kubectl get configmap app-config -o yaml

# Edit ConfigMap
kubectl edit configmap app-config

# Delete ConfigMap
kubectl delete configmap app-config

Secrets

# Create generic secret from literal
kubectl create secret generic db-credentials \
  --from-literal=username=admin \
  --from-literal=password='P@ssw0rd!'

# Create secret from file
kubectl create secret generic ssh-key --from-file=ssh-privatekey=~/.ssh/id_rsa

# Create Docker registry secret
kubectl create secret docker-registry regcred \
  --docker-server=docker.io \
  --docker-username=myuser \
  --docker-password=mypassword \
  --docker-email=myemail@example.com

# Create TLS secret
kubectl create secret tls tls-secret \
  --cert=path/to/cert.crt \
  --key=path/to/key.key

# Get secrets
kubectl get secrets

# Describe secret (doesn't show values)
kubectl describe secret db-credentials

# View secret data (base64 encoded)
kubectl get secret db-credentials -o yaml

# Decode secret value
kubectl get secret db-credentials -o jsonpath='{.data.password}' | base64 --decode

# Edit secret
kubectl edit secret db-credentials

# Delete secret
kubectl delete secret db-credentials
Security Warning: Kubernetes secrets are base64 encoded, not encrypted. Always use additional encryption at rest (KMS, sealed-secrets, external secret management like Vault).
Pro Tip: Use sealed-secrets or external secret operators like External Secrets Operator for GitOps workflows. This allows you to commit encrypted secrets to Git safely.

Storage & Volumes

# Get Persistent Volumes
kubectl get pv

# Get Persistent Volume Claims
kubectl get pvc

# Describe PVC
kubectl describe pvc <pvc-name>

# Get storage classes
kubectl get storageclass
kubectl get sc

# Describe storage class
kubectl describe storageclass <storage-class-name>

# Check PVC status and binding
kubectl get pvc -o wide

# View PVC events
kubectl describe pvc <pvc-name> | grep Events -A 10

# Delete PVC (careful: may delete data)
kubectl delete pvc <pvc-name>

# Force delete stuck PVC
kubectl patch pvc <pvc-name> -p '{"metadata":{"finalizers":null}}'

Scenario: Debug storage issues and PVC binding problems

# Check if PV is bound to PVC
kubectl get pv,pvc

# View PV details including claim reference
kubectl get pv <pv-name> -o yaml | grep -A 5 claimRef

# Check volume attachment to nodes
kubectl get volumeattachments

# Describe volume attachment
kubectl describe volumeattachment <attachment-name>

# Check CSI drivers
kubectl get csidrivers

# Check CSI nodes
kubectl get csinodes

RBAC & Security

Scenario: Check permissions and debug RBAC issues

# Check if you can perform an action
kubectl auth can-i create pods
kubectl auth can-i create deployments --namespace=production
kubectl auth can-i '*' '*' --all-namespaces

# Check permissions for another user
kubectl auth can-i get pods --as=john@example.com
kubectl auth can-i create services --as=system:serviceaccount:default:my-sa

# List your permissions
kubectl auth can-i --list

# List permissions for a specific namespace
kubectl auth can-i --list --namespace=production

Service Accounts

# Get service accounts
kubectl get serviceaccounts
kubectl get sa

# Describe service account
kubectl describe sa <sa-name>

# Create service account
kubectl create serviceaccount <sa-name>

# Get service account token
kubectl create token <sa-name>

Roles and RoleBindings

# Get roles and cluster roles
kubectl get roles
kubectl get clusterroles

# Get role bindings
kubectl get rolebindings
kubectl get clusterrolebindings

# Describe role
kubectl describe role <role-name>

# View who can perform action
kubectl get rolebindings,clusterrolebindings --all-namespaces -o json | jq '.items[] | select(.subjects[]?.kind=="User" and .subjects[]?.name=="john@example.com")'

# Create role
kubectl create role pod-reader --verb=get,list,watch --resource=pods

# Create role binding
kubectl create rolebinding pod-reader-binding --role=pod-reader --user=john@example.com

# Create cluster role binding
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=admin@example.com
Pro Tip: Use kubectl access-matrix plugin for visual RBAC debugging: kubectl krew install access-matrix then kubectl access-matrix

Advanced Troubleshooting

Scenario: Complete troubleshooting workflow for a failing application

# Step 1: Check pod status
kubectl get pods -l app=myapp

# Step 2: Describe pod for events and conditions
kubectl describe pod <pod-name>

# Step 3: Check logs from all containers
kubectl logs <pod-name> --all-containers=true

# Step 4: Check previous logs if pod restarted
kubectl logs <pod-name> --previous

# Step 5: Check resource usage
kubectl top pod <pod-name>

# Step 6: Check node health
kubectl get nodes
kubectl describe node <node-name>

# Step 7: Check events in namespace
kubectl get events --sort-by='.lastTimestamp' | grep <pod-name>

# Step 8: Check if service endpoints exist
kubectl get endpoints <service-name>

# Step 9: Test DNS resolution
kubectl run debug --rm -it --image=busybox -- nslookup <service-name>

# Step 10: Test network connectivity
kubectl run debug --rm -it --image=nicolaka/netshoot -- curl http://<service-name>

Resource Usage Analysis

# Get pod resource usage
kubectl top pods

# Get pod resource usage with containers
kubectl top pods --containers

# Get node resource usage
kubectl top nodes

# Get resource usage for specific namespace
kubectl top pods -n production

# Sort pods by CPU usage
kubectl top pods --sort-by=cpu

# Sort pods by memory usage
kubectl top pods --sort-by=memory
Note: kubectl top requires metrics-server to be installed in your cluster.

Event Analysis

# Get all events sorted by time
kubectl get events --all-namespaces --sort-by='.lastTimestamp'

# Get events for last 1 hour
kubectl get events --all-namespaces --field-selector involvedObject.kind=Pod --sort-by='.lastTimestamp' | awk '{if(NR>1)print}'

# Watch events in real-time
kubectl get events --watch

# Get events for specific pod
kubectl get events --field-selector involvedObject.name=<pod-name>

# Get warning events only
kubectl get events --field-selector type=Warning

# Get events from specific namespace
kubectl get events -n production --sort-by='.lastTimestamp'

Advanced Debugging Tools

# Use stern for multi-pod log tailing (requires stern)
stern <app-name>

# Tail logs from all pods with label
stern -l app=nginx

# Debug with different tools based on issue:

# Network debugging (nicolaka/netshoot image)
kubectl run netshoot --rm -it --image=nicolaka/netshoot -- bash

# Inside netshoot, you can use:
# - tcpdump, wireshark
# - curl, wget
# - nslookup, dig
# - traceroute, mtr
# - netstat, ss
# - iperf3

# Kubernetes API debugging
kubectl proxy --port=8080
# Then access: http://localhost:8080/api/v1

# Get raw API response
kubectl get --raw /api/v1/namespaces/default/pods

Performance & Optimization

Resource Quotas & Limits

# Get resource quotas
kubectl get resourcequota
kubectl get quota

# Describe resource quota
kubectl describe quota <quota-name>

# Get limit ranges
kubectl get limitrange
kubectl get limits

# Describe limit range
kubectl describe limitrange <limitrange-name>

# Check namespace resource usage vs quota
kubectl describe namespace <namespace>

Horizontal Pod Autoscaler (HPA)

# Get HPA status
kubectl get hpa

# Describe HPA
kubectl describe hpa <hpa-name>

# Create HPA
kubectl autoscale deployment nginx --cpu-percent=70 --min=2 --max=10

# Create HPA with custom metrics
kubectl autoscale deployment nginx --cpu-percent=70 --memory-percent=80 --min=2 --max=10

# Delete HPA
kubectl delete hpa <hpa-name>

# Watch HPA scaling in real-time
kubectl get hpa <hpa-name> --watch

Vertical Pod Autoscaler (VPA)

# Get VPA recommendations
kubectl get vpa

# Describe VPA
kubectl describe vpa <vpa-name>

# View VPA recommendations
kubectl get vpa <vpa-name> -o jsonpath='{.status.recommendation}'
Pro Tip: Use VPA in "recommendation" mode first to analyze optimal resource requests before enabling auto-update mode.

GitOps & CI/CD Integration

Scenario: Integrate kubectl in CI/CD pipelines safely

# Wait for deployment to be ready (use in CI/CD)
kubectl wait --for=condition=available --timeout=300s deployment/nginx

# Check rollout status with exit code (for CI/CD)
kubectl rollout status deployment/nginx --timeout=300s

# Perform smoke test after deployment
kubectl run smoke-test --rm -it --image=curlimages/curl --restart=Never -- curl http://nginx

# Validate YAML before applying (dry-run)
kubectl apply --dry-run=client -f deployment.yaml

# Validate on server side
kubectl apply --dry-run=server -f deployment.yaml

# Diff before applying
kubectl diff -f deployment.yaml

# Set image with change cause annotation
kubectl set image deployment/nginx nginx=nginx:1.21
kubectl annotate deployment/nginx kubernetes.io/change-cause="Updated to nginx 1.21 via CI/CD"

ArgoCD/FluxCD Integration

# Check Application health (ArgoCD)
kubectl get applications -n argocd

# Describe Application
kubectl describe application <app-name> -n argocd

# Check HelmRelease (FluxCD)
kubectl get helmreleases -n flux-system

# Describe HelmRelease
kubectl describe helmrelease <release-name> -n flux-system

# Check GitRepository source
kubectl get gitrepositories -n flux-system

Pro Tips for Platform Engineers

1. Use kubectl plugins (krew) for enhanced functionality
# Install krew (kubectl plugin manager)
# Visit: https://krew.sigs.k8s.io/docs/user-guide/setup/install/

# Useful plugins:
kubectl krew install ctx          # Context switching
kubectl krew install ns           # Namespace switching
kubectl krew install tree         # Resource hierarchy visualization
kubectl krew install neat         # Clean YAML output
kubectl krew install access-matrix # RBAC visualization
kubectl krew install tail         # Multi-pod log tailing
kubectl krew install sniff        # Network packet capture
kubectl krew install node-shell   # Get shell on node
2. Optimize kubectl with aliases and shell completion
# Add to ~/.bashrc or ~/.zshrc:

# Kubectl aliases
alias k='kubectl'
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
alias kgd='kubectl get deployments'
alias kdp='kubectl describe pod'
alias kl='kubectl logs'
alias klf='kubectl logs -f'
alias kex='kubectl exec -it'
alias kaf='kubectl apply -f'
alias kdelf='kubectl delete -f'
alias kgpw='kubectl get pods --watch'
alias kctx='kubectl config use-context'
alias kns='kubectl config set-context --current --namespace'

# Enable kubectl auto-completion
source <(kubectl completion bash)  # for bash
source <(kubectl completion zsh)   # for zsh

# Make aliases work with completion
complete -F __start_kubectl k
3. Use kubectl output formatting for better insights
# JSON output with jq filtering
kubectl get pods -o json | jq '.items[] | {name:.metadata.name, status:.status.phase}'

# Custom columns output
kubectl get pods -o custom-columns=NAME:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeName

# JSONPath output
kubectl get pods -o jsonpath='{.items[*].metadata.name}'

# Wide output (more details)
kubectl get pods -o wide

# YAML output (for backup/restore)
kubectl get deployment nginx -o yaml > nginx-deployment.yaml

# Get specific field
kubectl get pod nginx-pod -o jsonpath='{.status.podIP}'

# Sort output
kubectl get pods --sort-by=.metadata.creationTimestamp
4. Advanced kubectl techniques
# Watch multiple resources at once
kubectl get pods,svc,deploy --watch

# Use labels effectively for organization
kubectl label pods nginx-pod env=production tier=frontend
kubectl get pods -l env=production,tier=frontend

# Use annotations for metadata
kubectl annotate pod nginx-pod description="Production nginx server"

# Patch resources quickly
kubectl patch deployment nginx -p '{"spec":{"replicas":5}}'

# Replace resources (instead of apply)
kubectl replace -f deployment.yaml

# Convert between API versions
kubectl convert -f old-deployment.yaml --output-version apps/v1

# Generate YAML without creating resources
kubectl create deployment nginx --image=nginx --dry-run=client -o yaml > deployment.yaml

# Create resources from stdin
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:latest
EOF
5. Secure kubectl usage in production
  • Always use RBAC with least privilege principle
  • Use separate kubeconfigs for different environments (dev/staging/prod)
  • Enable audit logging for kubectl API calls
  • Use admission controllers (OPA/Kyverno) to enforce policies
  • Never run kubectl apply directly in production - use GitOps
  • Use --dry-run and kubectl diff before applying changes
  • Implement network policies to restrict pod communication
  • Rotate service account tokens regularly
  • Use Pod Security Admission/Standards for workload security
6. Performance optimization tips
  • Use --field-selector and -l (label selector) to reduce API load
  • Avoid kubectl get all --all-namespaces in production - too resource intensive
  • Use kubectl top regularly to identify resource bottlenecks
  • Set proper resource requests and limits on all workloads
  • Enable HPA for stateless applications
  • Use node affinity and pod anti-affinity for better distribution
  • Implement pod disruption budgets (PDB) for high availability

Quick Reference Tables

Common Command Patterns

Task Command
Get resources kubectl get <resource>
Describe resource kubectl describe <resource> <name>
Create resource kubectl create <resource> <name>
Delete resource kubectl delete <resource> <name>
Edit resource kubectl edit <resource> <name>
Apply YAML kubectl apply -f file.yaml
Export YAML kubectl get <resource> <name> -o yaml
Watch resources kubectl get <resource> --watch

Resource Short Names

Full Name Short Name
podspo
servicessvc
deploymentsdeploy
replicasetsrs
statefulsetssts
daemonsetsds
namespacesns
configmapscm
persistentvolumespv
persistentvolumeclaimspvc
ingressesing
networkpoliciesnetpol
serviceaccountssa

Output Formats

Format Usage
-o wideAdditional details (IP, Node, etc.)
-o yamlYAML format (for backup/restore)
-o jsonJSON format (for parsing)
-o jsonpathExtract specific fields
-o custom-columnsCustom column output
-o nameResource name only

Integration with Atmosly Platform

How Atmosly Enhances Kubectl Workflows

While kubectl is powerful, managing Kubernetes clusters at scale requires additional platform capabilities. Atmosly provides:

  • Visual Pipeline Builder — Build CI/CD pipelines without memorizing kubectl commands
  • GitOps Integration — Automated kubectl operations through Git workflows
  • Audited Web Terminal — Scoped kubectl access from the browser, recorded and reviewable
  • Multi-Cluster Management — Manage EKS, GKE, AKS and imported clusters from one interface instead of juggling kubectl contexts
  • Environment Cloning — Duplicate a complete environment (services, config, databases) without re-wiring anything
  • One Audit Trail — Every provision, deploy, approval and rollback recorded with who, what, when and the diff

Learn more about Atmosly, the SquareOps internal developer platform

Additional Resources

Conclusion

This comprehensive kubectl cheat sheet covered over 150+ commands organized by real-world scenarios. Whether you're debugging a production incident, deploying new applications, or managing RBAC policies, you now have a complete reference guide.

Master These Key Takeaways:
  • Always use kubectl describe and kubectl logs for debugging
  • Leverage kubectl apply --dry-run and kubectl diff before changes
  • Use labels and selectors for efficient resource management
  • Implement RBAC with least privilege principle
  • Monitor resource usage with kubectl top
  • Automate with GitOps instead of direct kubectl in production
  • Use kubectl plugins (krew) to enhance functionality

Next Steps:

  1. Bookmark this page for quick reference
  2. Practice these commands in a safe environment (minikube, kind)
  3. Set up kubectl aliases and completion in your shell
  4. Install useful kubectl plugins via krew
  5. Integrate kubectl best practices into your CI/CD pipelines.
  6. Explore Atmosly for platform-level Kubernetes management.

Happy Kuberneting!