Files
hapi/infra/k8s/README.md
T
Bobby 88235fc824 feat: Add PostgreSQL Kubernetes deployment with Kustomize
- Create infrastructure for PostgreSQL StatefulSet in Kubernetes
- Implement environment-specific configurations (staging/production)
- Add Kustomize overlays for deterministic deployments
- Document deployment process in AGENTS.md and infra/k8s/README.md
- Include Makefile and helper scripts for easy management

New directories:
- infra/k8s/base/ - Shared resources (StatefulSet, Service, PVC, Namespace)
- infra/k8s/staging/ - Staging environment overlay
- infra/k8s/production/ - Production environment overlay

Key files:
- infra/k8s/base/kustomization.yaml
- infra/k8s/staging/kustomization.yaml
- infra/k8s/production/kustomization.yaml
- infra/k8s/README.md

Resources are prefixed by environment (staging-, production-) and deployed
to the postgres namespace.
2026-11-18 15:29:00 -05:00

72 lines
1.6 KiB
Markdown

# PostgreSQL Kubernetes Deployments
This directory contains Kustomize configurations for deploying PostgreSQL to different environments.
## Directory Structure
```
k8s/
├── base/ # Base resources shared across environments
│ ├── kustomization.yaml
│ ├── namespace.yaml
│ ├── statefulset.yaml
│ ├── service.yaml
│ └── pvc.yaml
├── staging/ # Staging environment configuration
│ └── kustomization.yaml
├── production/ # Production environment configuration
│ └── kustomization.yaml
└── README.md
```
## Usage
### Staging Environment
```bash
kubectl apply -k infra/k8s/staging
```
### Production Environment
```bash
kubectl apply -k infra/k8s/production
```
### Dry Run
```bash
kubectl apply -k infra/k8s/staging --dry-run=client
```
## Resource Naming
Resources are prefixed with the environment name:
- **Staging**: `staging-postgres-*`
- **Production**: `production-postgres-*`
## Environment Variables
The `ENVIRONMENT` variable is embedded in ConfigMaps:
- **Staging**: `ENVIRONMENT=staging`
- **Production**: `ENVIRONMENT=production`
## Secrets
The following secrets are expected in the `postgres` namespace:
- `postgres-secrets` with keys:
- `username`: PostgreSQL username
- `password`: PostgreSQL password
## Configuration
Each environment's `kustomization.yaml` customizes:
- `namePrefix`: Environment-specific prefix
- `commonLabels`: Environment label applied to all resources
- `patches`: Adds environment label to Service, PVC, and StatefulSet
- `configMapGenerator`: Creates ConfigMap with `ENVIRONMENT` value