-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Current Behavior
The current Kubernetes deployment configuration combines both Hasura and its PostgreSQL database in a single pod within a Deployment resource. This is causing conflicts during application upgrades and potential stability issues.
Expected Behavior
The PostgreSQL database should be deployed separately using a StatefulSet to ensure proper lifecycle management and data persistence.
Technical Details
Current Issues:
- Database and application are tightly coupled in the same pod
- Hasura's readiness probe is checking PostgreSQL on localhost, which is problematic in a multi-container setup
- Database upgrades and maintenance are complicated by the current architecture
- PVC management is not optimal for a database workload
Proposed Solution:
- Move PostgreSQL to a separate StatefulSet
- Update Hasura's configuration to connect to the database via a service
- Implement proper readiness probes for both components
- Use volumeClaimTemplates for database storage
Implementation Plan
- Create new StatefulSet for PostgreSQL:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mint-hasura-db
spec:
serviceName: mint-hasura-db
# ... StatefulSet configuration- Create headless service for database connectivity:
apiVersion: v1
kind: Service
metadata:
name: mint-hasura-db
spec:
clusterIP: None
# ... Service configuration- Update Hasura deployment to remove database container and update connection settings
Benefits
- Improved stability during upgrades
- Better database lifecycle management
- Proper persistence handling
- Easier maintenance and debugging
- Independent scaling capabilities
Migration Strategy
- Backup existing database
- Deploy new StatefulSet and Service
- Migrate data to new database instance
- Update Hasura configuration
- Validate functionality
- Remove old deployment
Additional Notes
- The current password and username secrets can be reused
- Need to update documentation after implementation
- Consider adding monitoring for the database component
Related Files
apps/v1/hasura.yaml- Any database initialization scripts
- Related configuration maps and secrets
Metadata
Metadata
Assignees
Labels
No labels