Skip to main content
This guide shows how to migrate the voting application from standalone Pod manifests and NodePort Services to Kubernetes Deployments (which manage ReplicaSets and Pods for you). Moving from raw Pods to Deployments gives you:
  • Declarative scaling (replicas).
  • Self-healing (automatically recreates failed Pods).
  • Rolling updates (upgrade without downtime or manual Pod replacement).
Why migrate? Running individual Pods has these limitations:
  • No simple scaling (e.g., to increase from 1 to 5 instances).
  • No controller to watch and recreate failed Pods.
  • No built-in rolling upgrade mechanism — manual Pod replacement can cause downtime.
Comparison: Pod vs Deployment Prerequisite: This guide assumes you previously deployed the voting and result apps as Pods and exposed them with NodePort Services so they could be reached externally. kubectl cleanup
Tip: To convert a Pod manifest to a Deployment, move the Pod spec into spec.template of the Deployment, and add replicas and a selector.matchLabels that matches template.metadata.labels.
Make sure spec.selector.matchLabels in the Deployment exactly matches spec.template.metadata.labels. If they differ, the Deployment will reject the manifest.
Service configuration Service manifests do not need to change when you move from Pods to Deployments — just ensure the Service selector matches the labels used by the Deployment templates. Example NodePort snippet used to expose the vote app (unchanged from the pod-based configuration):
Original Pod manifest (for reference)
Create Deployments Below are concise, corrected Deployment manifests for each component. Each uses apiVersion: apps/v1, includes replicas, selector.matchLabels, and template (the embedded Pod spec). Place these manifests in your deployments directory and apply them with kubectl apply -f .. vote-deployment.yaml
result-deployment.yaml
redis-deployment.yaml
db-deployment.yaml
worker-deployment.yaml
Apply deployments and services
Verify Services and Deployments
To see everything at once:
Scaling a Deployment To scale the vote Deployment to 5 replicas:
Verify the scale
When you refresh the application endpoint, each request may be served by a different Pod (you can see the Pod suffix in the app UI), demonstrating load distribution across replicas. Conclusion You’ve migrated from Pod manifests to Kubernetes Deployments, giving your application declarative scaling, automatic self-healing, and safe rolling updates. Links and references

Watch Video