Linux command
kubectl-describe 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Describe pod
kubectl describe pod [pod-name]
Describe node
kubectl describe node [node-name]
Describe deployment
kubectl describe deployment [deployment-name]
Describe with selector
kubectl describe pods -l [app=myapp]
Describe in namespace
kubectl describe pod [pod-name] -n [namespace]
说明
kubectl describe produces a detailed, human-readable summary of one or more Kubernetes resources. Unlike `kubectl get`, which returns structured data fields, describe aggregates information from multiple API calls to present a comprehensive view that includes resource metadata, spec, current status, conditions, allocated resources, mounted volumes, and associated events. The command is particularly valuable for troubleshooting, as the Events section at the bottom of the output shows recent actions taken by controllers, schedulers, and the kubelet -- such as image pull failures, scheduling decisions, readiness probe results, and container restarts. For nodes, it displays capacity, allocatable resources, running pods, and system conditions. Output from describe is formatted for human consumption and should not be parsed programmatically. For structured data suitable for scripting, use `kubectl get -o json` or `kubectl get -o yaml` instead.
参数
- -l _SELECTOR_
- Label selector.
- -n _NAMESPACE_
- Target namespace.
- --all-namespaces
- Search all namespaces.
- --help
- Display help information.
FAQ
What is the kubectl-describe command used for?
kubectl describe produces a detailed, human-readable summary of one or more Kubernetes resources. Unlike `kubectl get`, which returns structured data fields, describe aggregates information from multiple API calls to present a comprehensive view that includes resource metadata, spec, current status, conditions, allocated resources, mounted volumes, and associated events. The command is particularly valuable for troubleshooting, as the Events section at the bottom of the output shows recent actions taken by controllers, schedulers, and the kubelet -- such as image pull failures, scheduling decisions, readiness probe results, and container restarts. For nodes, it displays capacity, allocatable resources, running pods, and system conditions. Output from describe is formatted for human consumption and should not be parsed programmatically. For structured data suitable for scripting, use `kubectl get -o json` or `kubectl get -o yaml` instead.
How do I run a basic kubectl-describe example?
Run `kubectl describe pod [pod-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -l _SELECTOR_ do in kubectl-describe?
Label selector.