# Kubernetes Deployment ## Secrets Management Secrets are stored in `.envrc` files (gitignored): - Project root `.envrc` - Used by direnv for local development - `k8s/.envrc` - Used by Kustomize for secret generation Kustomize automatically generates the `towerops-sendgrid` Secret from `k8s/.envrc` using the `secretGenerator` in `kustomization.yaml`. Both `.envrc` files should contain: ```bash # SendGrid Configuration SENDGRID_API_KEY=your-api-key-here export SENDGRID_API_KEY ``` The KEY=VALUE format works for both Kustomize and direnv. ## Deploying Apply all resources using kustomize: ```bash kubectl apply -k k8s/ ``` Or individually: ```bash kubectl apply -f k8s/namespace.yaml kubectl apply -f k8s/secret.yaml kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml kubectl apply -f k8s/service-headless.yaml kubectl apply -f k8s/certificate.yaml kubectl apply -f k8s/ingressroute.yaml ```