Skip to main content
In this walkthrough, you’ll learn how to convert an existing ReplicaSet into a fully managed Deployment. Deployments offer declarative updates, rollbacks, and scaling capabilities—making them the recommended way to run replicas in production. We’ll:
  1. Prepare the project structure
  2. Create the Deployment manifest
  3. Apply the Deployment
  4. Verify the rollout and inspect resources

1. Prepare the directories and files

  1. From your project root, create a folder named deployments.
  2. Inside deployments, create a file called deployment.yaml.
To see what we’re building on, here’s the reference ReplicaSet we defined earlier:

2. Create the Deployment manifest

Copy the spec from the ReplicaSet into deployments/deployment.yaml, then:
  • Change kind to Deployment
  • Set metadata.name and labels to match your application
  • Adjust replicas to 3 (or your desired count)
The selector.matchLabels field must exactly match the labels on the Pod template. Otherwise, Kubernetes won’t know which Pods belong to this Deployment.

3. Apply the Deployment

Run:
Or, if you prefer create:

4. Verify the rollout and inspect resources

You can quickly see the status of your Deployment and its Pods:
  1. Check the Deployment status
    Example output:
  2. List the Pods
    Example output:
  3. Describe the Deployment
    You’ll see details such as desired vs. available replicas, rollout strategy, and recent events:
The image shows a terminal window displaying Kubernetes deployment details for an application named "myapp," including container information, conditions, and events related to scaling the replica set.
  1. View all objects in the namespace
    Example output:
To roll out updates, modify spec.template.spec.containers[].image and run:
Then track progress with:

Watch Video