Deployment
This guide walks you through deploying Menatic AI on a Kubernetes cluster using kubectl and the provided manifests.
Prerequisites
Section titled “Prerequisites”- Kubernetes cluster (1.28+) with
kubectlaccess - Docker registry accessible from the cluster
- Traefik ingress controller installed
cert-managerfor TLS (optional but recommended)
Step 1: Clone the Repository
Section titled “Step 1: Clone the Repository”git clone https://github.com/menatic-ai/ftn-ai.gitcd ftn-aiStep 2: Configure the Environment
Section titled “Step 2: Configure the Environment”Copy the example configuration and edit values for your environment:
cp k8s/config.example.yaml k8s/config.yamlKey configuration values:
| Variable | Description |
|---|---|
DOMAIN | Base domain for ingress (e.g., ai.example.com) |
JWT_SECRET | Secret key for JWT signing (generate with openssl rand -hex 32) |
DB_PASSWORD | Database password |
ADMIN_PASSWORD | Initial admin password |
Step 3: Build and Push Images
Section titled “Step 3: Build and Push Images”# Build backenddocker build -t your-registry/ftn-ai-backend:latest ./backenddocker push your-registry/ftn-ai-backend:latest
# Build frontenddocker build -t your-registry/ftn-ai-frontend:latest ./frontenddocker push your-registry/ftn-ai-frontend:latestStep 4: Create Namespaces
Section titled “Step 4: Create Namespaces”kubectl create namespace ftn-aikubectl create namespace appsStep 5: Apply RBAC Manifests
Section titled “Step 5: Apply RBAC Manifests”kubectl apply -f k8s/rbac/This creates the necessary ClusterRole and ClusterRoleBinding so the backend can manage workloads across namespaces.
Step 6: Deploy the Platform
Section titled “Step 6: Deploy the Platform”kubectl apply -f k8s/This deploys:
- Backend API server
- Frontend (Next.js)
- PostgreSQL database
- Traefik ingress rules
Step 7: Verify the Deployment
Section titled “Step 7: Verify the Deployment”kubectl get pods -n ftn-aiAll pods should reach Running status within a few minutes.
Step 8: Install metrics-server
Section titled “Step 8: Install metrics-server”The dashboard requires metrics-server for real-time CPU and memory usage:
# For k3d / local clusters:kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
# For k3d, patch to disable TLS verification:kubectl patch deployment metrics-server -n kube-system \ --type=json \ -p='[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
# For managed clusters (EKS, GKE, AKS):# metrics-server is usually pre-installed or available via the cloud provider add-onStep 9: Access the Platform
Section titled “Step 9: Access the Platform”Navigate to https://your-domain and log in with the admin credentials configured in Step 2.
Local Development with k3d
Section titled “Local Development with k3d”For local development, use k3d to run a cluster with a local image registry:
# Create cluster with registryk3d cluster create ftn-ai \ --registry-create localhost:5050 \ -p "80:80@loadbalancer" \ -p "443:443@loadbalancer"
# Build and push to local registrydocker build -t localhost:5050/ftn-ai-backend:latest ./backenddocker push localhost:5050/ftn-ai-backend:latestUpgrading
Section titled “Upgrading”To upgrade the platform, rebuild and push new images, then roll out the deployments:
kubectl rollout restart deployment/ftn-ai-backend -n ftn-aikubectl rollout restart deployment/ftn-ai-frontend -n ftn-ai