The kubectl describe
command in Kubernetes is invaluable for gaining detailed insights into various resources within your cluster. It provides a comprehensive view of the configuration and current state of Kubernetes objects, aiding in troubleshooting, debugging, and understanding resource behaviors.
Example 1: Describe a Pod
To examine the details of a specific pod named my-pod
in the default namespace:
kubectl describe pod my-pod
This command fetches and displays extensive information about the specified pod, such as its labels, status, events, and associated containers.
Verification: Check for the detailed output including events and conditions of the pod to confirm successful execution.
Example 2: Describe a Service
To understand the specifics of a service named my-service
:
kubectl describe service my-service
It provides details about the service, including its IP address, ports, selectors, and related endpoints.
Verification: Look for the information regarding the service’s IP, ports, and endpoints to validate the command’s execution.
Example 3: Describe a Deployment
To inspect the configuration and current status of a deployment named my-deployment
:
kubectl describe deployment my-deployment
This command reveals essential details such as replicas, strategy, conditions, and the latest deployment events.
Verification: Review the deployment’s replicas and recent events to ensure the command executed correctly.
Example 4: Describe a Node
To get comprehensive information about a node named node-1
:
kubectl describe node node-1
This command provides details about the node’s capacity, addresses, status, and associated pods.
Verification: Check for the node’s capacity, addresses, and status fields to confirm the execution of the command.
Example 5: Describe a Namespace
To examine the details of a specific namespace named my-namespace
:
kubectl describe namespace my-namespace
It displays information about the namespace, including labels, status, and resource quotas.
Verification: Look for the namespace’s labels and resource quotas to verify the successful execution of the command.
Example 6: Describe an Ingress
To inspect the configuration and details of an ingress named my-ingress
:
kubectl describe ingress my-ingress
This command provides information about the ingress, including rules, backends, and associated services.
Verification: Review the ingress rules and backends to ensure that the command executed properly.
Example 7: Describe a ConfigMap
To get detailed information about a config map named my-configmap
:
kubectl describe configmap my-configmap
This command displays the configuration data stored in the specified config map.
Verification: Check for the data stored in the config map to confirm the execution of the command.
Example 8: Describe a PersistentVolumeClaim
To inspect the details of a persistent volume claim named my-pvc
:
kubectl describe pvc my-pvc
This command provides information about the persistent volume claim, including its status and volume details.
Verification: Look for the status and volume information to ensure the command was executed successfully.
Example 9: Describe a Secret
To view the details of a secret named my-secret
:
kubectl describe secret my-secret
This command displays information about the specified secret, including its type and data fields.
Verification: Check for the type and data fields of the secret to confirm that the command executed as expected.
Example 10: Describe a StatefulSet
To examine the configuration and status of a stateful set named my-statefulset
:
kubectl describe statefulset my-statefulset
This command provides details about the stateful set, including its pods, volumes, and update strategy.
Verification: Review the pods and volumes associated with the stateful set to verify the successful execution of the command.
Also check similar articles.
Update Node Taints with kubectl taint
Prepare Nodes for Maintenance with kubectl drain
Scheduling Nodes in Kubernetes with kubectl uncordon
How to Cordon Kubernetes Nodes with kubectl cordon
Monitor Resource Usage with kubectl top
Discussion about this post