October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Using kubectl to Get Deployments, ReplicaSets, and Pods in YAML

Use kubectl get with -o yaml to inspect Deployments, ReplicaSets, and Pods, whether in the current namespace, a selected namespace, or across the cluster.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose 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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How 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.

  • apiVersion and kind identify the API schema version and resource type.
  • metadata.name and metadata.namespace identify the object and its namespace.
  • metadata.labels can help connect related resources. For a Pod, metadata.ownerReferences can identify its owning ReplicaSet.
  • spec describes desired configuration. A Deployment’s spec.replicas is its desired replica count, and its Pod template describes the Pods it creates.
  • status reflects 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:

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.