Use kubectl get with -o yaml to print Kubernetes Deployment, ReplicaSet, or Pod objects in YAML format. For example: kubectl get deployments -o yaml, kubectl get replicasets -o yaml, and kubectl get pods -o yaml. By default, these commands return matching resources from your current namespace.
Commands to get Kubernetes resources as YAML
The -o yaml option controls the output format; it does not change which resource kind the command requests. Kubernetes documents this output as KYAML, a Kubernetes-specific dialect that can be parsed as YAML. See the kubectl quick reference and kubectl get reference.
As an Amazon Associate I earn from qualifying purchases.
List resources in the current namespace
kubectl get deployments -o yaml
kubectl get replicasets -o yaml
kubectl get pods -o yaml
Each command returns the requested kind in the current namespace. Short resource names also work: rs for ReplicaSets and po for Pods.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteChoose a namespace or query all namespaces
kubectl get pods -n NAMESPACE -o yaml
kubectl get pods -A -o yaml
Replace NAMESPACE with the namespace to inspect. The -A option is shorthand for --all-namespaces and queries across namespaces instead of using the current namespace.
#1 Best Overall
Get one named object
kubectl get deployment nginx-deployment -o yaml
kubectl get replicaset REPLICASET_NAME -o yaml
kubectl get pod POD_NAME -o yaml
Use the corresponding resource kind and exact object name. Kubernetes resource types are case-insensitive, but resource names are case-sensitive. The official reference also demonstrates kubectl get pod NAME -o yaml.
Which layer should you inspect?
Deployments, ReplicaSets, and Pods represent connected but different layers of a workload. The Kubernetes Deployment documentation describes a Deployment as managing a set of Pods to run an application workload, usually one that does not maintain state.
| Resource | What it tells you | Typical YAML command |
|---|---|---|
| Deployment | Desired workload configuration and rollout behavior | kubectl get deployment NAME -o yaml |
| ReplicaSet | How a controller maintains the requested number of matching Pods | kubectl get replicasets -o yaml |
| Pod | Configuration and observed state for an individual workload instance | kubectl get pods -o yaml |
A Deployment manages Pods through ReplicaSets. When a Pod template changes, Kubernetes creates a new ReplicaSet and scales it up while scaling down the older one during a controlled rollout. The ReplicaSet, in turn, maintains the desired count of matching Pods. See the Deployment guide and ReplicaSet guide.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesHow to read the returned YAML
A resource object commonly contains identifying metadata, desired configuration, and observed status. Inspect these fields to understand what the object represents and how it relates to the other workload layers.
Rank #3
apiVersionandkindidentify the API schema version and resource type.metadata.nameandmetadata.namespaceidentify the object and its namespace.metadata.labelscan help connect related resources. For a Pod,metadata.ownerReferencescan identify its owning ReplicaSet.specdescribes desired configuration. A Deployment’sspec.replicasis its desired replica count, and its Pod template describes the Pods it creates.statusreflects observed state. Interpret its fields in the context of that resource; a Deployment’s readiness, updated, and available replica counts describe different aspects of progress.
Deployment-created ReplicaSets commonly follow the naming pattern DEPLOYMENT-NAME-HASH in the documentation’s examples. The pod-template-hash label ties the template identity to the ReplicaSet selector, the Pod template labels, and the resulting Pods. These identifiers and owner references help trace a Pod back through its controller chain.
Check rollout health separately
Getting a Deployment’s YAML shows its configuration and status fields, but the presence of the object alone does not prove its Pods are healthy or that an update has finished. To check progress for a particular Deployment, run:
Rank #4
kubectl rollout status deployment/NAME
Replace NAME with the Deployment name. Compare the reported rollout progress with the Deployment and Pod status when diagnosing an update.
Recommended Free Tools
Version considerations
The kubectl reference and Kubernetes API details can change over time. The documentation cited here was accessed on September 28, 2026; for version-sensitive behavior, check the documentation that matches the Kubernetes and kubectl versions in your environment.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




