Mattermost Example

Mattermost is a flexible, open source messaging platform that meets even the most demanding privacy and security standards.

How to run

  • Save this example to file, e.g mattermost.yaml
  • Change host names myapp.kuber.host to domain of your namespace (see your domains)
  • Activate database in dashboard (database settings)
  • Run with kubectl apply -f mattermost.yaml

To customize override config at /mattermost/config/config.json or use enviroments variables. Documentation: https://docs.mattermost.com/administration/config-settings.html

Example Screenshot

ghost.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mattermost-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mattermost
  labels:
    app: mattermost

spec:
  replicas: 1
  template:
    metadata:
      name: mattermost-app
      labels:
        app: mattermost
        tier: app
    spec:
      containers:
      - name: mattermost-app
        image: mattermost/mattermost-prod-app:latest
        resources:
          limits: { memory: "300Mi", cpu: "300m" }
        securityContext:
          runAsUser: 0
        command: ["sh", "-c"]
        args:
          - MM_SQLSETTINGS_DATASOURCE=$DATABASE_URL?sslmode=verify-full\&connect_timeout=10 /entrypoint.sh mattermost
        envFrom:
          - configMapRef: {name: database-config}
        env:
          - name: MM_LOGSETTINGS_ENABLECONSOLE
            value: "true"
          - name: MM_LOGSETTINGS_CONSOLELEVEL
            value: INFO
        ports:
          - containerPort: 8000
        volumeMounts:
          - name: appdata
            mountPath: /mattermost/data
        readinessProbe:
          httpGet:
            path: /
            port: 8000
          initialDelaySeconds: 5
          periodSeconds: 10
      volumes:
        - name: appdata
          persistentVolumeClaim:
            claimName: mattermost-pvc

---

apiVersion: v1
kind: Service
metadata:
  name: mattermost
spec:
  type: LoadBalancer
  ports:
  - port: 8000
    name: http
  selector:
    app: mattermost

---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: mattermost-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    certmanager.k8s.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/proxy-body-size: "200m"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "120"
spec:
  tls:
    - hosts:
      - myapp.kuber.host
      secretName: myapp-kuber-host
  rules:
  - host: myapp.kuber.host
    http:
      paths:
      - path: /
        backend:
          serviceName: mattermost
          servicePort: 8000