Orchestration

kubectl Cheat Sheet: Essential Commands for Windows, Mac & Linux

August 1, 2026 Kubezilla Team 2 min read

One of kubectl’s biggest strengths is consistency — once installed, the commands behave identically whether you’re on Windows, macOS, or Linux. This cheat sheet rounds up the commands you’ll use daily, organized by task.

Cluster and Context Commands

Use kubectl cluster-info to view basic cluster details, kubectl config get-contexts to list available contexts, and kubectl config use-context <name> to switch between clusters.

Working with Pods

kubectl get pods lists pods in the current namespace, kubectl describe pod <name> shows detailed status and events, and kubectl logs <name> streams container logs for debugging.

Managing Deployments

kubectl get deployments shows deployment status, kubectl rollout restart deployment <name> triggers a rolling restart, and kubectl scale deployment <name> --replicas=3 adjusts pod count.

Applying and Deleting Resources

kubectl apply -f file.yaml creates or updates resources from a manifest, while kubectl delete -f file.yaml removes them. Both commands work identically regardless of your operating system.

Debugging and Troubleshooting

kubectl exec -it <pod> -- /bin/bash opens an interactive shell inside a running container, and kubectl port-forward <pod> 8080:80 forwards a local port to a pod for direct testing.

Namespace Management

kubectl get namespaces lists all namespaces, and kubectl config set-context --current --namespace=<name> sets your default working namespace so you don’t need to specify it on every command.

FAQ

Are kubectl commands the same across all operating systems?
Yes, the command syntax is identical everywhere; only the installation process differs by platform.

What’s the fastest way to memorize these commands?
Set up shell autocompletion (covered in our Linux, Mac, and Windows install guides) so you can tab-complete most of the syntax rather than memorizing it outright.

Conclusion

Once kubectl is installed, day-to-day usage is identical across every operating system. Bookmark this cheat sheet as a quick reference while you build muscle memory for the commands you use most.

Leave a comment