docs: update kubernetes deployment page (#4835)

This commit is contained in:
Matti Nannt
2025-02-28 20:38:02 +01:00
committed by GitHub
parent ffa534d5eb
commit 4acc85bd12

View File

@@ -1,37 +1,63 @@
---
title: "Kubernetes Deployment"
description: "Deploy Formbricks on a Kubernetes cluster using Helm."
icon: "circle-nodes"
title: "Kubernetes Deployment"
description: "Deploy Formbricks on a Kubernetes cluster using Helm."
icon: "circle-nodes"
---
# Deploying Formbricks on Kubernetes
This guide explains how to deploy Formbricks on a Kubernetes cluster using Helm. The primary focus is on deploying Formbricks pods in a production-ready environment with external database services.
This guide explains how to deploy Formbricks on a **Kubernetes cluster** using **Helm**. It assumes that:
- You **already have a Kubernetes cluster** running (e.g., DigitalOcean, GKE, AWS, Minikube).
- An **Ingress controller** (e.g., Traefik, Nginx) is configured.
- You have **Helm installed** on your local machine.
## Prerequisites
---
Before you begin, ensure that:
## 🚀 **Step 1: Install Formbricks with Helm**
- You have a running Kubernetes cluster (AWS EKS, GCP GKE, Azure AKS, Minikube, etc.)
- An Ingress controller (e.g., Traefik, Nginx) is configured
- You have Helm installed on your local machine
- For production environments, you have access to external PostgreSQL and Redis services
> **Important:** Running multiple Formbricks pods in a cluster setup requires a Formbricks Enterprise license. With the Community Edition, only a single Formbricks pod is supported. Redis is required when deploying multiple Formbricks pods for proper session handling and caching.
## Basic Installation
### Step 1: Clone the Formbricks Helm Chart
### **1⃣ Clone the Formbricks Helm Chart**
```sh
git clone https://github.com/formbricks/formbricks.git
cd formbricks/helm-chart
```
### **2 Deploy Formbricks**
### Step 2: Deploy Formbricks
For a basic deployment with a single pod (Community Edition) and PostgreSQL running in the cluster:
```sh
helm install my-formbricks ./ \
helm install my-formbricks ./ \
--namespace formbricks \
--create-namespace \
--set replicaCount=2
--set redis.enabled=false \
--create-namespace
```
## Production Deployment
For production environments, we recommend using managed database and cache services like AWS RDS for PostgreSQL and AWS ElastiCache for Redis:
```sh
helm install my-formbricks ./ \
--namespace formbricks \
--create-namespace \
--set replicaCount=3 \
--set postgresql.enabled=false \
--set postgresql.externalUrl="postgresql://user:password@your-postgres-host:5432/formbricks" \
--set redis.enabled=false \
--set redis.externalUrl="redis://your-redis-host:6379"
```
> **Note:** The above multi-pod configuration requires a Formbricks Enterprise license. Redis is enabled and configured to support multiple Formbricks pods.
## Verify Installation
### Check Running Services
## 🎯 **Step 2: Verify and Access Formbricks**
### **Check the Running Services**
```sh
kubectl get pods -n formbricks
kubectl get svc -n formbricks
@@ -40,24 +66,16 @@ kubectl get ingress -n formbricks
> **Note:** The Formbricks application pod may take some time to reach a stable state as it runs database migrations during startup.
### **Access Formbricks**
- If running locally with **Minikube**:
### Access Formbricks
- If running locally with Minikube:
```sh
minikube service my-formbricks -n formbricks
```
- If deployed on a **cloud cluster**, visit:
```
https://formbricks.example.com
```
---
- If deployed on a cloud cluster, make sure to set up your ingress controller properly and visit the domain or IP address associated with your ingress.
## Upgrading Formbricks
This section provides guidance on how to upgrade your Formbricks deployment using Helm, including examples of common upgrade scenarios.
### Upgrade Process
To upgrade your Formbricks deployment, use:
```bash
@@ -69,8 +87,6 @@ helm upgrade my-formbricks ./ --namespace formbricks
#### 1. Updating Environment Variables
To update or add new environment variables, use the `--set` flag with the `env` prefix:
```bash
helm upgrade my-formbricks ./ --namespace formbricks \
--set env.SMTP_HOST=new-smtp.example.com \
@@ -78,23 +94,7 @@ helm upgrade my-formbricks ./ --namespace formbricks \
--set env.NEW_CUSTOM_VAR=newvalue
```
This command updates the SMTP host and port, and adds a new custom environment variable.
#### 2. Enabling or Disabling Features
You can enable or disable features by updating their respective values:
```bash
# Disable Redis
helm upgrade my-formbricks ./ --namespace formbricks --set redis.enabled=false
# Enable Redis
helm upgrade my-formbricks ./ --namespace formbricks --set redis.enabled=true
```
#### 3. Scaling Resources
To adjust resource allocation:
#### 2. Scaling Resources
```bash
helm upgrade my-formbricks ./ --namespace formbricks \
@@ -104,21 +104,19 @@ helm upgrade my-formbricks ./ --namespace formbricks \
--set resources.requests.memory=1Gi
```
#### 4. Updating Autoscaling Configuration
To modify autoscaling settings:
#### 3. Updating Autoscaling Configuration
```bash
helm upgrade my-formbricks ./ --namespace formbricks \
--set autoscaling.enabled=true \
--set autoscaling.minReplicas=3 \
--set autoscaling.maxReplicas=10 \
--set autoscaling.metrics[0].resource.target.averageUtilization=75
```
#### 5. Changing Database Credentials
> **Note:** Enabling autoscaling requires a Formbricks Enterprise license and proper Redis configuration.
To update PostgreSQL database credentials:
To switch from the built-in PostgreSQL to an external database or update the external database credentials:
#### 4. Changing Database Connection
```bash
helm upgrade my-formbricks ./ --namespace formbricks \
@@ -126,30 +124,31 @@ helm upgrade my-formbricks ./ --namespace formbricks \
--set postgresql.externalUrl="postgresql://newuser:newpassword@external-postgres-host:5432/newdatabase"
```
This command disables the built-in PostgreSQL and configures Formbricks to use an external PostgreSQL database. Make sure your external database is set up and accessible before making this change.
## Advanced Configuration Options
For advanced configurations including:
- Deploying PostgreSQL and Redis within your Kubernetes cluster
- Configuring Traefik ingress controller
- Setting up high availability
- Customizing autoscaling behavior
## Full Values Documentation
Please refer to the complete Helm chart documentation at:
[https://github.com/formbricks/formbricks/tree/main/helm-chart](https://github.com/formbricks/formbricks/tree/main/helm-chart)
Below is a comprehensive list of all configurable values in the Formbricks Helm chart:
## Key Configuration Values
| Field | Description | Default |
| ----------------------------------------------------------- | ------------------------------------------ | ------------------------------- |
| `image.repository` | Docker image repository for Formbricks | `ghcr.io/formbricks/formbricks` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.tag` | Docker image tag | `"2.6.0"` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Kubernetes service port | `80` |
| `service.targetPort` | Container port to expose | `3000` |
| `resources.limits.cpu` | CPU resource limit | `500m` |
| `resources.limits.memory` | Memory resource limit | `1Gi` |
| `resources.requests.cpu` | Memory resource request | `null` |
| `resources.requests.memory` | Memory resource request | `null` |
| `autoscaling.enabled` | Enable autoscaling | `false` |
| `autoscaling.minReplicas` | Minimum number of replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of replicas | `5` |
| `autoscaling.metrics[0].type` | Type of metric for autoscaling | `Resource` |
| `autoscaling.metrics[0].resource.name` | Resource name for autoscaling metric | `cpu` |
| `autoscaling.metrics[0].resource.target.type` | Target type for autoscaling | `Utilization` |
| `autoscaling.metrics[0].resource.target.averageUtilization` | Average utilization target for autoscaling | `80`
| Field | Description | Default |
| ------------------------- | ----------------------------- | ------------------------------- |
| `replicaCount` | Number of Formbricks replicas | `1` |
| `image.repository` | Docker image repository | `ghcr.io/formbricks/formbricks` |
| `image.tag` | Docker image tag | `"2.6.0"` |
| `resources.limits.cpu` | CPU resource limit | `500m` |
| `resources.limits.memory` | Memory resource limit | `1Gi` |
| `autoscaling.enabled` | Enable autoscaling | `false` |
| `postgresql.enabled` | Deploy PostgreSQL in cluster | `true` |
| `postgresql.externalUrl` | External PostgreSQL URL | `""` |
| `redis.enabled` | Deploy Redis in cluster | `false` |
| `redis.externalUrl` | External Redis URL | `""` |
For the complete list of configuration options, please refer to the Formbricks Helm chart repository.