Skip to content

Repository files navigation

Kubernetes Deployment for SafePoll (vote-app)

Files

  • namespace.yaml - creates the vote-app namespace.
  • 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 /api to the backend.

Deployment Notes

  1. 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
  1. Update secret values in k8s/mongodb-secret.yaml before deploying.

  2. Apply all manifests using kustomize:

kubectl apply -k k8s/

This applies all resources defined in kustomization.yaml in the correct order.

  1. If you use vote-app.local in the ingress, add it to your /etc/hosts or DNS for local access.

Important

  • The frontend is configured to send API calls to /api, so the ingress routes backend traffic correctly.
  • The frontend uses NEXT_PUBLIC_API_URL which is baked into the bundle at build time. The Dockerfile handles this with a build arg defaulting to /api.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors