Kubernetes deployment configuration using Kustomize for the Group1 microservices platform.
The repository structure:
simpleSlideshow-deploy/
├── base/ # Base Kubernetes manifests for all services
│ ├── ChatService/
│ ├── CommunityService/
│ ├── NotificationService/
│ ├── RecommendationService/
│ ├── UserService/
│ ├── VideoService/
│ │ ├── deployment-videoservice.yaml
│ │ ├── deployment-postgresql.yaml
│ │ ├── deployment-ngrok.yaml # Webhook testing in dev
│ │ ├── service-*.yaml
│ │ ├── route-*.yaml
│ │ ├── secret-*.yaml
│ │ ├── pvc-postgresql.yaml
│ │ ├── hpa-videoservice.yaml # Horizontal Pod Autoscaler
│ │ └── kustomization.yaml
│ └── kustomization.yaml # Root base kustomization
├── overlays/ # Environment-specific configurations
│ ├── prod/
│ │ └── kustomization.yaml # Production overlay
│ └── test/
│ └── kustomization.yaml # Test overlay
└── docs/ # Additional documentation
- ChatService - Real-time chat and messaging
- CommunityService - Community interactions (likes, favorites, comments, shares, watch history)
- NotificationService - Push notifications and alerts
- RecommendationService - Personalized content recommendations using collaborative filtering
- UserService - User authentication and profile management
- VideoService - Video upload, streaming, and downloads with Mux integration (includes PostgreSQL)
| Environment | Namespace | Image Tag | Branch |
|---|---|---|---|
| test | projectgroup1-test |
:dev |
dev |
| prod | projectgroup1-prod |
:main |
main |
# Deploy all services to test environment
kubectl apply -k overlays/test
# Deploy all services to prod environment
kubectl apply -k overlays/prod
# Deploy specific service only (from base)
kubectl apply -k base/VideoService
kubectl apply -k base/RecommendationServicePoint ArgoCD applications to:
- Test environment:
overlays/test - Prod environment:
overlays/prod
The overlays reference all services from the base directory and apply environment-specific configurations (image tags, namespaces, etc.).
VideoService provides video management with Mux integration for streaming and downloads.
Features:
- Dual-asset strategy: Clean videos for streaming + watermarked videos for downloads
- Private video streaming with JWT-signed URLs
- Mux webhook integration for asset processing
- Automatic sync to RecommendationService when videos are ready
- PostgreSQL database with persistent storage
Configuration:
The deployment includes:
- PostgreSQL database with PVC (Persistent Volume Claim)
- Ngrok service for webhook testing in development
- Health checks (liveness and readiness probes)
- Horizontal Pod Autoscaler (HPA) for scaling
Environment Variables (configured in deployment):
WATERMARK_ENABLED- Enable/disable watermarks (default: true)WATERMARK_IMAGE_URL- URL to watermark image (must be publicly accessible HTTPS)WATERMARK_POSITION- Position: top-left, top-right, bottom-left, bottom-rightWATERMARK_WIDTH- Watermark width in pixelsWATERMARK_HEIGHT- Watermark height in pixelsWATERMARK_OPACITY- Opacity from 0.0 to 1.0
Secrets Required:
MUX_TOKEN_ID- Mux API token IDMUX_TOKEN_SECRET- Mux API token secretMUX_WEBHOOK_SECRET- Mux webhook signature verificationMUX_SIGNING_KEY_ID- For generating JWT-signed playback URLsMUX_SIGNING_KEY_PRIVATE_KEY- Base64-encoded private keySERVICE_TOKEN- Shared token for RecommendationService syncRECOMMENDATION_SERVICE_URL- RecommendationService endpointKEYCLOAK_URL,KEYCLOAK_REALM,KEYCLOAK_CLIENT_ID,KEYCLOAK_AUDIENCE- Authentication
Provides personalized video recommendations using collaborative filtering and content-based algorithms.
Features:
- LightFM-based collaborative filtering with weighted interactions
- Multiple recommendation sources: collaborative, trending, popular, new content
- Category and tag-based filtering
- Automatic model training jobs
- Video sync endpoints for real-time updates
Configuration:
The deployment includes:
- PostgreSQL database with PVC
- Prometheus metrics endpoint for monitoring
- Health checks and readiness probes
Secrets Required:
SERVICE_TOKEN- Shared token for authenticating sync requests from other services- Database credentials (DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD)
VideoService → RecommendationService:
- Automatically syncs new videos when assets are ready
- Sends video ID, categories, and tags
- Authenticated via SERVICE_TOKEN
CommunityService → RecommendationService:
- Syncs user interactions (likes, favorites, shares, watches, comments)
- Real-time updates for recommendation algorithm
- Authenticated via SERVICE_TOKEN
VideoService → UserService:
- Fetches user preferences (interests, discovery radius)
- Used for personalizing video feed
- Authenticated via JWT token forwarding
Secrets are stored in Kubernetes Secret objects for each service. Example structure:
apiVersion: v1
kind: Secret
metadata:
name: videoservice-secrets
type: Opaque
stringData:
MUX_TOKEN_ID: "your_token_id"
MUX_TOKEN_SECRET: "your_token_secret"
MUX_WEBHOOK_SECRET: "your_webhook_secret"
MUX_SIGNING_KEY_ID: "your_signing_key_id"
MUX_SIGNING_KEY_PRIVATE_KEY: "base64_encoded_key"
SERVICE_TOKEN: "shared_service_token"
# ... additional secretsImportant: The SERVICE_TOKEN must be identical across:
- VideoService
- RecommendationService
- CommunityService
This ensures proper authentication for inter-service sync operations.
Edit the deployment YAML in base/ServiceName/deployment-servicename.yaml:
env:
- name: WATERMARK_ENABLED
value: "true"
- name: WATERMARK_IMAGE_URL
value: "https://cdn.example.com/watermark.png"Then apply the changes:
kubectl apply -k base/ServiceName/Secrets are managed separately and referenced in deployments. Update via:
# Create or update secret
kubectl create secret generic videoservice-secrets \
--from-literal=MUX_TOKEN_ID=your_token_id \
--from-literal=SERVICE_TOKEN=shared_token \
--dry-run=client -o yaml | kubectl apply -f -Changes to deployment configurations trigger rolling updates automatically:
- New pods are created with updated config
- Old pods are terminated after new ones are ready
- Zero downtime for most configuration changes
All services expose health check endpoints:
/health/liveor/healthz- Liveness probe/health/readyor/ready- Readiness probe with dependency checks
Services expose Prometheus metrics:
- VideoService:
/metricson port 9090 - RecommendationService:
/metricson port 8084
ServiceMonitor resources are configured for Prometheus autodiscovery.
If videos aren't appearing in recommendations:
-
Check VideoService logs for sync errors:
oc logs deployment/videoservice -n projectgroup1-prod | grep -i "sync\|recommendation"
-
Verify SERVICE_TOKEN matches across services:
oc get secret videoservice-secrets -o jsonpath='{.data.SERVICE_TOKEN}' | base64 -d oc get secret recommendationservice-secrets -o jsonpath='{.data.SERVICE_TOKEN}' | base64 -d
-
Check RecommendationService sync endpoint:
oc logs deployment/recommendationservice -n projectgroup1-prod | grep -i "sync"
If downloads have no watermark:
-
Verify WATERMARK_IMAGE_URL is accessible:
curl -I https://your-watermark-url.png
-
Check VideoService logs during upload:
oc logs deployment/videoservice -n projectgroup1-prod | grep -i "watermark"
-
Ensure environment variables are set:
oc get deployment videoservice -o yaml | grep -A5 WATERMARK
If services can't connect to PostgreSQL:
-
Check database pod status:
oc get pods | grep postgresql -
Verify database credentials:
oc get secret videoservice-secrets -o yaml
-
Test database connectivity:
oc exec -it deployment/videoservice-postgresql -- psql -U postgres -d videoservice -c "SELECT 1"