How to install Jahia with Kubernetes
Question
How to install Jahia with Kubernetes?
Answer
π¦This procedure is not meant for a production environment as it has not been validated by our Product and QA teams. Please only use it for discovery purposes.
π Prerequisites:
- Kubernetes cluster up and running
kubectlinstalled and configured
π© Step-by-Step Installation Guide
β Step 1: Prepare Kubernetes Namespace
It's recommended to deploy Jahia in its own namespace:
kubectl create namespace jahia
kubectl config set-context --current --namespace=jahia
β Step 2: Set Up Database
Jahia 8 requires a database backend (e.g., MySQL/PostgreSQL):
Create a file named mysql-pv.yaml to create the persistent volume:
apiVersion: v1
kind: PersistentVolume
metadata:
name: jahia-mysql-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jahia-mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
Deploy with:
kubectl apply -f mysql-pv.yaml
Create a file named mysql-deployment.yaml to create the MySQL pod:
apiVersion: v1
kind: Service
metadata:
name: jahia-mysql
spec:
ports:
- name: jahia-mysql
port: 3306
targetPort: 3306
selector:
app: jahia-mysql
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jahia-mysql
spec:
selector:
matchLabels:
app: jahia-mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: jahia-mysql
spec:
containers:
- image: mysql:9
name: jahia-mysql
env:
# Use secret in real usage
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: jahia-mysql
volumeMounts:
- name: jahia-mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: jahia-mysql-persistent-storage
persistentVolumeClaim:
claimName: jahia-mysql-pv-claim
Deploy with:
kubectl apply -f mysql-deployment.yaml
β Step 3: Deploy the Jahia processing
Create a file named jahia-processing-deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jahia-processing
labels:
app: jahia-processing
spec:
replicas: 1
selector:
matchLabels:
app: jahia-processing
template:
metadata:
labels:
app: jahia-processing
spec:
containers:
- name: jahia-processing
image: jahia/jahia-ee:8.2.2.0
ports:
- containerPort: 8080
env:
- name: DB_VENDOR
value: "mysql"
- name: DB_HOST
value: "jahia-mysql.jahia.svc.cluster.local"
- name: DB_NAME
value: "jahia"
- name: DB_USER
value: "root"
- name: DB_PASS
value: "password"
- name: CLUSTER_ENABLED
value: "true"
- name: PROCESSING_SERVER
value: "true"
- name: jahia_cfg_cluster.node.serverId
value: processing
volumeMounts:
- name: jahia-storage
mountPath: /var/jahia
volumes:
- name: jahia-storage
persistentVolumeClaim:
claimName: jahia-processing-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jahia-processing-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: standard
Deploy with:
kubectl apply -f jahia-deployment.yaml
β Step 4: Deploy the Jahia browsings
Create a file named jahia-browsing-deployment.yaml:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: jahia-browsing
labels:
app: jahia-browsing
spec:
replicas: 2
selector:
matchLabels:
app: jahia-browsing
template:
metadata:
labels:
app: jahia-browsing
spec:
containers:
- name: jahia-browsing
image: jahia/jahia-ee:8.2.2.0
ports:
- containerPort: 8080
env:
- name: DB_VENDOR
value: "mysql"
- name: DB_HOST
value: "jahia-mysql.jahia.svc.cluster.local"
- name: DB_NAME
value: "jahia"
- name: DB_USER
value: "root"
- name: DB_PASS
value: "password"
- name: CLUSTER_ENABLED
value: "true"
- name: PROCESSING_SERVER
value: "false"
- name: jahia_cfg_cluster.node.serverId
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: jahia-storage
mountPath: /var/jahia
volumeClaimTemplates:
- metadata:
name: jahia-storage
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 50Gi
storageClassName: standard
---
Deploy with:
kubectl apply -f jahia-deployment.yaml
β Step 5: Accessing Jahia UI
- Check your deployment status:
kubectl get pods,svc,pvc,pv -n jahia
-
Execute the following command to redirect your TCP port 8080 to the same TCP port of the pod jahia
kubectl port-forward pod/JAHIA_POD_ID 8080:8080
Default Jahia admin credentials (initial setup):
- Username:
root - Password: Initially set during Jahia first-setup wizard (on UI).
π¦ Troubleshooting & Useful Commands:
Check logs:
kubectl logs -f deploy/jahia-processing
Monitor events:
kubectl get events -w
If a pod is stuck, describe it:
kubectl describe pod <pod-name>
If you want to enter in a pod:
kubectl exec --stdin --tty pod/JAHIA_POD_ID -- /bin/bash
Using the Docker registry from Docker (ghcr.io)
Create a secret in Kubernetes:
kubectl create secret docker-registry github_docker_registry_cred --docker-server=https://ghcr.io --docker-username=<GITHUB_USERNAME> --docker-password=<GITHUB_TOKEN> --docker-email=<GITHUB_EMAIL>
Modify the file jahia-processing-deployment.yaml and jahia-browsing-deployment.yaml so this secret is used, for example:
template:
metadata:
labels:
app: jahia-processing
spec:
imagePullSecrets:
- name: github_docker_registry_cred
containers:
- name: jahia-processing
image: ghcr.io/jahia/jahia-ee:8.2.2.0
β You're now running Jahia 8.2.2.0 on Kubernetes!