veza/k8s/README.md

125 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

# Kubernetes Deployment Manifests
This directory contains Kubernetes manifests for deploying Veza Platform to production.
## Structure
```
k8s/
├── namespace.yaml # Namespace definition
├── configmap.yaml # Configuration values
├── secrets.yaml.example # Example secrets (DO NOT COMMIT REAL SECRETS)
├── ingress.yaml # Ingress configuration
├── backend-api/
│ ├── deployment.yaml # Backend API deployment
│ └── service.yaml # Backend API service
├── frontend/
│ ├── deployment.yaml # Frontend deployment
│ └── service.yaml # Frontend service
└── stream-server/
└── (see veza-stream-server/k8s/production/)
```
## Prerequisites
- Kubernetes cluster 1.24+
- kubectl configured
- Docker images built and pushed to registry
- Secrets configured (see secrets.yaml.example)
## Deployment Steps
### 1. Create Namespace
```bash
kubectl apply -f k8s/namespace.yaml
```
### 2. Create Secrets
```bash
# Copy example and fill in real values
cp k8s/secrets.yaml.example k8s/secrets.yaml
# Edit secrets.yaml with real values
kubectl create secret generic veza-secrets \
--from-env-file=k8s/secrets.yaml \
-n veza-production
```
### 3. Create ConfigMap
```bash
kubectl apply -f k8s/configmap.yaml
```
### 4. Deploy Services
```bash
# Backend API
kubectl apply -f k8s/backend-api/
# Frontend
kubectl apply -f k8s/frontend/
# Stream Server (if separate)
kubectl apply -f veza-stream-server/k8s/production/
```
### 5. Create Ingress
```bash
kubectl apply -f k8s/ingress.yaml
```
## Verification
```bash
# Check pods
kubectl get pods -n veza-production
# Check services
kubectl get svc -n veza-production
# Check ingress
kubectl get ingress -n veza-production
# View logs
kubectl logs -f deployment/veza-backend-api -n veza-production
```
## Scaling
```bash
# Scale backend API
kubectl scale deployment veza-backend-api --replicas=5 -n veza-production
# Scale frontend
kubectl scale deployment veza-frontend --replicas=3 -n veza-production
```
## Updates
```bash
# Update image
kubectl set image deployment/veza-backend-api \
backend-api=veza-backend-api:v1.1.0 \
-n veza-production
# Rollout status
kubectl rollout status deployment/veza-backend-api -n veza-production
```
## Troubleshooting
```bash
# Describe pod
kubectl describe pod <pod-name> -n veza-production
# Get events
kubectl get events -n veza-production --sort-by='.lastTimestamp'
# Port forward for debugging
kubectl port-forward deployment/veza-backend-api 8080:8080 -n veza-production
```