# Kubernetes Deployment Guide This guide provides instructions for deploying the MerchantsOfHope recruiting platform to Kubernetes. ## Prerequisites - Kubernetes cluster (v1.20 or higher) - kubectl configured to access the cluster - Docker image built and accessible (either in a registry or locally if using kind/minikube) ## Deployment Steps 1. **Build and push the Docker image** ```bash docker build -t your-registry/merchants_of_hope:latest . docker push your-registry/merchants_of_hope:latest ``` Then update the image name in `k8s/deployment.yaml` to match your registry. 2. **Update secrets** The `k8s/secrets.yaml` file contains template placeholders. You need to: - Generate base64 encoded values for all secrets - Or use a more secure method like HashiCorp Vault or AWS Secrets Manager Example of encoding a secret: ```bash echo -n 'your-secret-value' | base64 ``` 3. **Deploy the application** Run the deployment script: ```bash ./deploy.sh ``` 4. **Verify the deployment** Check that all resources are running: ```bash kubectl get pods -n merchants-of-hope kubectl get services -n merchants-of-hope kubectl get ingress -n merchants-of-hope ``` ## Production Considerations 1. **Database**: In production, use a managed database service (AWS RDS, Azure Database, GCP Cloud SQL) rather than running PostgreSQL in Kubernetes. 2. **Secrets Management**: Implement a proper secrets management system instead of static secrets files. 3. **Monitoring**: Add Prometheus and Grafana for monitoring application metrics. 4. **Logging**: Implement centralized logging with tools like ELK stack or similar. 5. **Security**: - Implement network policies - Use pod security policies/standards - Enable RBAC properly - Consider service mesh for microservices (Istio, Linkerd) 6. **High Availability**: Adjust replica counts and implement proper health checks for production. 7. **Auto-scaling**: Configure Horizontal Pod Autoscaler based on metrics. ## Rollback Procedure To rollback to a previous version: ```bash kubectl rollout undo deployment/merchants-of-hope-app -n merchants-of-hope ``` ## Health Checks The application exposes a `/health` endpoint that returns the application status.