Skip to main content
Welcome to our comprehensive guide on kubectl commands—a must-read refresher for anyone working with Kubernetes. In this article, we cover a series of powerful commands tailored for troubleshooting and diagnosing Kubernetes applications. While this is not an exhaustive catalog of all available kubectl commands, it highlights some of the most commonly used options for quickly solving common issues.
This guide is intended as a quick reference for troubleshooting with kubectl. For a complete list of commands and options, please refer to the Kubernetes Documentation.

Commands Overview

The following kubectl commands will be discussed in detail:
Each of these commands plays a key role in managing Kubernetes clusters effectively:

Diving Deeper

Let’s dive into each command to understand how they can help you troubleshoot and diagnose Kubernetes applications:
  • kubectl get: Start by listing your resources to understand the current state of your cluster.
  • kubectl describe: After identifying a resource, use this command for deeper insight into its configuration and status.
  • kubectl logs: If a pod is experiencing issues, view its logs to help isolate the problem.
  • kubectl explain: Use this command to learn about the fields and configuration options available for any resource.
  • kubectl exec: Run commands inside a container for real-time debugging.
  • kubectl port-forward: When direct network access is limited, forward local ports to your pod.
  • kubectl top node: Monitor nodes to ensure they have adequate resources.
  • kubectl diff: Compare current and desired states to understand configuration changes.
  • kubectl auth-can-i: Check if your permissions allow a certain operation to avoid authorization issues.
For more in-depth guidance on these commands, including examples and best practices, consider exploring the official Kubernetes Basics guide.
With the commands outlined above, you’re well-equipped to effectively troubleshoot and diagnose issues within your Kubernetes environment. Happy debugging!

Watch Video