- A running Kubernetes cluster (minikube, kind, or a cloud cluster)
kubectlconfigured to talk to your cluster- A directory containing the YAML manifests you’ll create

1. Pod manifests
Pod manifests share the same top-level structure:apiVersion, kind, metadata (including name and labels), and spec (which defines containers). Create one YAML file per component:
voting-app-pod.yaml— voting UIresult-app-pod.yaml— results UIredis-pod.yaml— Redis data storedb-pod.yaml— Postgres databaseworker-pod.yaml— background worker
voting-app-pod.yaml):
result-app-pod.yaml):
redis-pod.yaml):
db-pod.yaml):
For Postgres,
POSTGRES_USER and POSTGRES_PASSWORD initialize the default database user. In production, supply secrets using Kubernetes Secrets rather than plain env values.worker-pod.yaml) — the worker only needs to run and communicate internally, so no ports are required:
Quick manifest summary
2. Service manifests
To enable network communication between components and to expose UIs, create Services for Redis, Postgres (db), vote, and result.- Use
ClusterIPfor internal services (Redis and Postgres). - Use
NodePortfor the vote and result UIs so you can open them in a browser for this demo.
redis-service.yaml):
db-service.yaml):
vote-service.yaml) — NodePort exposes the UI externally on node port 31000, mapping the Service port 8080 to container port 80:
result-service.yaml) — exposed on node port 31001 mapping Service port 8081 to container port 80:
Service summary
NodePort exposes ports on each cluster node and is suitable for demos. For production, consider using Ingress, a LoadBalancer Service, or a cloud LB rather than NodePort.
3. Apply manifests to the cluster
From the directory containing all YAML files, apply them in one command:4. Verify Pods and Services
Check that Pods are running:<service-port>:<nodePort>/TCP, for example 8080:31000/TCP.
5. Access the UIs
Find a node IP to access NodePort services:192.168.97.2:
- Vote UI: http://192.168.97.2:31000
- Result UI: http://192.168.97.2:31001

Conclusion
You have completed an end-to-end deployment of the Example Voting App on Kubernetes:- Pods for each component (vote, result, redis, db, worker)
- ClusterIP Services for internal-only components (Redis, Postgres)
- NodePort Services to expose vote and result UIs for demonstration
Secret objects, and use Ingress or LoadBalancer Services to expose public endpoints.