freeleaps-ops/cluster/manifests/freeleaps-data-platform/metabase/README.md
2025-08-21 11:07:48 +08:00

127 lines
3.2 KiB
Markdown

# Metabase Deployment
## Overview
This directory contains Kubernetes manifests for deploying Metabase, a business intelligence and analytics platform, along with its PostgreSQL database.
## Components
### 1. metabase-postgres.yaml
PostgreSQL database deployment:
- Persistent storage for data
- ConfigMap for database configuration
- Secret for database password
- Service for internal communication
### 2. metabase-deployment.yaml
Metabase application deployment:
- Metabase container with latest image
- Persistent storage for application data
- Environment variables for database connection
- Health checks and resource limits
- Service for internal communication
### 3. metabase-ingress.yaml
Ingress configuration for external access:
- Nginx ingress class
- Multiple host support (metabase.freeleaps.cluster, metabase.local)
- SSL redirect disabled for development
## Deployment Steps
### 1. Deploy PostgreSQL Database
```bash
kubectl apply -f metabase-postgres.yaml
```
### 2. Wait for PostgreSQL to be Ready
```bash
kubectl wait --for=condition=ready pod -l app=metabase-postgres -n metabase --timeout=300s
```
### 3. Deploy Metabase Application
```bash
kubectl apply -f metabase-deployment.yaml
```
### 4. Deploy Ingress (Optional)
```bash
kubectl apply -f metabase-ingress.yaml
```
### 5. Monitor Deployment
```bash
kubectl get pods -n metabase
kubectl get services -n metabase
kubectl get ingress -n metabase
```
## Configuration
### Database Connection
- **Type**: PostgreSQL
- **Host**: metabase-postgres
- **Port**: 5432
- **Database**: metabase
- **User**: metabase
- **Password**: metabasepassword
### Storage
- **Metabase Data**: 10Gi persistent storage
- **PostgreSQL Data**: 5Gi persistent storage
- **Storage Class**: azure-disk-std-ssd-lrs
### Resources
- **Metabase**: 512Mi-1Gi memory, 250m-500m CPU
- **PostgreSQL**: 256Mi-512Mi memory, 250m-500m CPU
## Access
### Internal Access
- **Metabase**: http://metabase.metabase.svc.cluster.local:3000
- **PostgreSQL**: metabase-postgres.metabase.svc.cluster.local:5432
### External Access (with Ingress)
- **Primary**: http://metabase.freeleaps.cluster
- **Alternative**: http://metabase.local
## Initial Setup
1. **First Access**: Navigate to the Metabase URL
2. **Setup Wizard**: Follow the initial setup wizard
3. **Database Connection**: Use the internal PostgreSQL connection
4. **Admin User**: Create the first admin user
5. **Data Sources**: Connect to your data sources
## Troubleshooting
### Check Pod Status
```bash
kubectl get pods -n metabase
kubectl describe pod <pod-name> -n metabase
```
### Check Logs
```bash
kubectl logs <pod-name> -n metabase
kubectl logs <pod-name> -n metabase -c postgres # for PostgreSQL
```
### Check Services
```bash
kubectl get services -n metabase
kubectl describe service metabase -n metabase
```
### Check Storage
```bash
kubectl get pvc -n metabase
kubectl describe pvc metabase-data -n metabase
```
## Notes
- **Initial Startup**: Metabase may take 2-3 minutes to start up on first deployment
- **Database**: Ensure PostgreSQL is fully ready before deploying Metabase
- **Storage**: Both Metabase and PostgreSQL use persistent storage for data persistence
- **Security**: Default password is base64 encoded, consider changing for production use