namespace.yaml- creates thevote-appnamespace.mongodb-secret.yaml- stores MongoDB root password, JWT secret, and app encryption secret.persistent-volume-claims.yaml- declares PVC for backend uploads.mongodb-statefulset.yaml- deploys MongoDB with a headless service.backend-deployment.yaml- deploys the Express backend.backend-service.yaml- exposes the backend inside the cluster.frontend-deployment.yaml- deploys the Next.js frontend.frontend-service.yaml- exposes the frontend inside the cluster.ingress.yaml- routes/to the frontend and/apito the backend.
- Build container images for the backend and frontend before applying manifests:
cd /path/to/vote-app
docker build -t vote-app-backend:latest ./backend
docker build -t vote-app-frontend:latest ./frontend-
Update secret values in
k8s/mongodb-secret.yamlbefore deploying. -
Apply all manifests using kustomize:
kubectl apply -k k8s/This applies all resources defined in
kustomization.yamlin the correct order.
- If you use
vote-app.localin the ingress, add it to your/etc/hostsor DNS for local access.
- The frontend is configured to send API calls to
/api, so the ingress routes backend traffic correctly. - The frontend uses
NEXT_PUBLIC_API_URLwhich is baked into the bundle at build time. The Dockerfile handles this with a build arg defaulting to/api.