Kubernetes kanboard

example for kubernetes 1.17

namespace:

apiVersion: v1
kind: Namespace
metadata:
   name: ns-kanboard

storage class:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage-kanboard
  namespace: ns-kanboard
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

storage pv and pvc:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: dba-kanboard-dba
  namespace: ns-kanboard
  labels:
    type: local
    srv: dbkanboard
spec:
  storageClassName: local-storage-kanboard
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/fs_kanboard/mysqldata/"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: dba-kanboard-cfg
  namespace: ns-kanboard
  labels:
    type: local
    srv: dbkanboard
spec:
  storageClassName: local-storage-kanboard
  capacity:
    storage: 200Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/fs_kanboard/mysqlcfg/"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: kanboard-data
  namespace: ns-kanboard
  labels:
    type: local
    app: kanboard
spec:
  storageClassName: local-storage-kanboard
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/fs_kanboard/data/"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: kanboard-ssl
  namespace: ns-kanboard
  labels:
    type: local
    app: kanboard
spec:
  storageClassName: local-storage-kanboard
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/fs_kanboard/ssl"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: kanboard-plugins
  namespace: ns-kanboard
  labels:
    type: local
    app: kanboard
spec:
  storageClassName: local-storage-kanboard
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/fs_kanboard/plugins"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    srv: dbakanboard
  name: dba-kanboard-dba
  namespace: ns-kanboard
spec:
  storageClassName: local-storage-kanboard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    srv: dbakanboard
  name: dba-kanboard-cfg
  namespace: ns-kanboard
spec:
  storageClassName: local-storage-kanboard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  name: kanboard-data
  namespace: ns-kanboard
spec:
  storageClassName: local-storage-kanboard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    app: kanboard
  name: kanboard-plugins
  namespace: ns-kanboard
spec:
  storageClassName: local-storage-kanboard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 200Mi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    app: kanboard
  name: kanboard-ssl
  namespace: ns-kanboard
spec:
  storageClassName: local-storage-kanboard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

deploy db

---
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dbkanboard
  namespace: ns-kanboard
spec:
  replicas: 1
  selector:
    matchLabels:
      srv: dbkanboard
  template:
    metadata:
      labels:
       srv: dbkanboard
      volumes:
      - name: kanboard-dba
        persistentVolumeClaim:
          claimName: dba-kanboard-dba
      - name: kanboard-cfg
        persistentVolumeClaim:
          claimName: dba-kanboard-cfg
      containers:
      - args:
        - --default-authentication-plugin=mysql_native_password
        env:
        - name: DEBUG
          value: 'true'
        - name: MYSQL_DATABASE
          value: kanboard
        - name: MYSQL_PASSWORD
          value: mysqlsecret
        - name: MYSQL_ROOT_PASSWORD
          value: secret
        - name: MYSQL_USER
          value: kanboarduser
        image: mariadb:latest
        name: dbkanboard
        ports:
        - containerPort: 3306
          protocol: TCP
          name: mariadb
        resources: {}
        volumeMounts:
        - mountPath: "/var/lib/mysql"
          name: kanboard-dba
        - mountPath: "/etc/mysql"
          name: kanboard-cfg
status: {}

deploy kanboard

---
##apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kanboard
  namespace: ns-kanboard
spec:
  replicas: 1
  selector:
    matchLabels:
      run: kanboard
  template:
    metadata:
      labels:
        run: kanboard
    spec:
      volumes:
      - name: kanboard-data
        persistentVolumeClaim:
          claimName: kanboard-data
      - name: kanboard-plugins
        persistentVolumeClaim:
          claimName: kanboard-plugins
      - name: kanboard-ssl
        persistentVolumeClaim:
          claimName: kanboard-ssl
      containers:
      - env:
        - name: DEBUG
          value: 'true'
        - name: DATABASE_URL
          value: 'mysql://kanboarduser:mysqlsecret@dbkanboard-service/kanboard'
        name: kanboard
        image: kanboard/kanboard:latest
        ports:
        - containerPort: 80
        - containerPort: 443
        volumeMounts:
        - mountPath: "/var/www/app/data"
          name: kanboard-data
        - mountPath: "/var/www/app/plugins"
          name: kanboard-plugins
        - mountPath: "/etc/nginx/ssl"
          name: kanboard-ssl
status: {}

service db

---
apiVersion: v1
kind: Service
metadata:
  name: dbkanboard-service
  namespace: ns-kanboard
spec:
  ports:
  - name: mariadb
    targetPort: 3306
    port: 3306
    protocol: TCP
  selector:
    srv: dbkanboard

service kanboard as nodeport

apiVersion: v1
kind: Service
metadata:
  name: kanboard-service
  namespace: ns-kanboard
spec:
  ports:
  - name: http
    targetPort: 80
    port: 80
    protocol: TCP
  - name: https
    targetPort: 443
    port: 443
    protocol: TCP
  type: NodePort
  selector:
    run: kanboard