-
-
Notifications
You must be signed in to change notification settings - Fork 219
Kubernetes
This guide explains how to deploy Mixcore CMS on Kubernetes clusters for scalable, resilient production environments.
- A working Kubernetes cluster (local or cloud-based)
- kubectl command-line tool
- Helm package manager (optional but recommended)
- Docker image of Mixcore CMS (see Docker Deployment)
- Basic knowledge of Kubernetes concepts
When deployed on Kubernetes, Mixcore CMS typically consists of:
- Application pods running the Mixcore CMS containers
- Database service (SQL Server or other supported database)
- Storage volumes for persistence
- Ingress controller for routing HTTP traffic
- Secrets for sensitive configuration
graph TD
A[Ingress] --> B[Mixcore Service]
B --> C[Mixcore Pods]
C --> D[Database Service]
D --> E[Database Pods]
C --> F[Persistent Volumes]
E --> G[Database Volumes]
kubectl create namespace mixcore
Create the SQL Server deployment YAML file mixcore-db.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
name: sqlserver
namespace: mixcore
spec:
replicas: 1
selector:
matchLabels:
app: sqlserver
template:
metadata:
labels:
app: sqlserver
spec:
containers:
- name: sqlserver
image: mcr.microsoft.com/mssql/server:2019-latest
env:
- name: ACCEPT_EULA
value: "Y"
- name: SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql-secret
key: SA_PASSWORD
ports:
- containerPort: 1433
volumeMounts:
- name: mssql-data
mountPath: /var/opt/mssql
volumes:
- name: mssql-data
persistentVolumeClaim:
claimName: mssql-pvc
---
apiVersion: v1
kind: Service
metadata:
name: sqlserver
namespace: mixcore
spec:
selector:
app: sqlserver
ports:
- port: 1433
targetPort: 1433
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mssql-pvc
namespace: mixcore
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Create the database secret:
kubectl create secret generic mssql-secret \
--from-literal=SA_PASSWORD="YourStrongPassword" \
--namespace mixcore
Apply the database configuration:
kubectl apply -f mixcore-db.yaml
Create the Mixcore deployment YAML file mixcore-app.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mixcore
namespace: mixcore
spec:
replicas: 3
selector:
matchLabels:
app: mixcore
template:
metadata:
labels:
app: mixcore
spec:
containers:
- name: mixcore
image: mixcore/mix.core:latest
ports:
- containerPort: 80
env:
- name: ASPNETCORE_ENVIRONMENT
value: Production
- name: ConnectionStrings__DefaultConnection
value: "Server=sqlserver;Database=mixcore;User=sa;Password=$(MSSQL_SA_PASSWORD);TrustServerCertificate=true"
envFrom:
- secretRef:
name: mssql-secret
volumeMounts:
- name: mixcore-media
mountPath: /app/wwwroot/media
- name: appsettings
mountPath: /app/appsettings.Production.json
subPath: appsettings.Production.json
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
volumes:
- name: mixcore-media
persistentVolumeClaim:
claimName: mixcore-media-pvc
- name: appsettings
configMap:
name: mixcore-config
---
apiVersion: v1
kind: Service
metadata:
name: mixcore
namespace: mixcore
spec:
selector:
app: mixcore
ports:
- port: 80
targetPort: 80
type: ClusterIP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mixcore-media-pvc
namespace: mixcore
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
Create the configuration map for application settings:
kubectl create configmap mixcore-config \
--from-file=appsettings.Production.json \
--namespace mixcore
Apply the Mixcore configuration:
kubectl apply -f mixcore-app.yaml
Create the Ingress YAML file mixcore-ingress.yaml
:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mixcore-ingress
namespace: mixcore
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
rules:
- host: mixcore.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mixcore
port:
number: 80
tls:
- hosts:
- mixcore.example.com
secretName: mixcore-tls-secret
Apply the Ingress configuration:
kubectl apply -f mixcore-ingress.yaml
For more automated deployments, you can use Helm:
-
Create a Helm chart for Mixcore:
helm create mixcore
-
Modify the chart templates to match your requirements
-
Install the Helm chart:
helm install mixcore ./mixcore --namespace mixcore --create-namespace
Create mixcore-hpa.yaml
:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mixcore-hpa
namespace: mixcore
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mixcore
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
Apply the HPA:
kubectl apply -f mixcore-hpa.yaml
For production environments, consider:
- SQL Server Always On Availability Groups
- Cloud-managed database services
- Database clustering solutions
-
Install the Prometheus Operator:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm install prometheus prometheus-community/kube-prometheus-stack \ --namespace monitoring --create-namespace
-
Create a ServiceMonitor for Mixcore:
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: mixcore-monitor namespace: monitoring spec: selector: matchLabels: app: mixcore endpoints: - port: http path: /metrics namespaceSelector: matchNames: - mixcore
Consider setting up the Elastic Stack (Elasticsearch, Logstash, Kibana) for centralized logging.
- Deploy a new version alongside the existing one
- Test the new version
- Switch traffic when ready
- Remove the old version
Configure traffic splitting in your Ingress controller:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mixcore-canary
annotations:
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "20"
-
Pod startup failures:
kubectl logs -n mixcore deployment/mixcore kubectl describe pod -n mixcore [pod-name]
-
Database connection issues:
- Verify secrets are correctly created
- Check network policies allow communication
- Ensure database service is running
-
Persistent volume issues:
- Check storage class availability
- Verify volume provisioning
- Check permissions on mounted volumes
- Docker Deployment for simpler container setup
- Infrastructure as Code for GitOps workflows
- Cloud Providers for managed Kubernetes solutions
- Visit our Community Forum
- Check the Troubleshooting Guide
- Contact Support for enterprise assistance