--- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: engelsystem-db labels: app: environment: spec: accessModes: - ReadWriteOnce storageClassName: resources: requests: storage: 2Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: database labels: app: environment: spec: replicas: 1 selector: matchLabels: app: environment: template: metadata: labels: app: environment: tier: database spec: containers: - image: mariadb:10.2 name: database imagePullPolicy: Always env: - name: MYSQL_DATABASE value: engelsystem - name: MYSQL_USER value: engelsystem - name: MYSQL_PASSWORD value: engelsystem - name: MYSQL_RANDOM_ROOT_PASSWORD value: '1' - name: MYSQL_INITDB_SKIP_TZINFO value: 'yes' volumeMounts: - mountPath: /var/lib/mysql name: data volumes: - name: data persistentVolumeClaim: claimName: engelsystem-db --- apiVersion: v1 kind: Service metadata: name: database labels: app: environment: commit: '' spec: type: ClusterIP ports: - port: 3306 targetPort: 3306 name: database selector: app: environment: tier: database --- apiVersion: apps/v1 kind: Deployment metadata: name: engelsystem labels: app: environment: commit: '' spec: replicas: selector: matchLabels: app: environment: strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 1 template: metadata: labels: app: environment: tier: application commit: '' annotations: app.gitlab.com/app: app.gitlab.com/env: commit: '' spec: initContainers: - image: name: engelsystem-migrate imagePullPolicy: Always command: - sh - -c - while ! bin/migrate up; do sleep 1; done env: - name: MYSQL_HOST value: database - name: MYSQL_DATABASE value: engelsystem - name: MYSQL_USER value: engelsystem - name: MYSQL_PASSWORD value: engelsystem containers: - image: name: engelsystem-fpm imagePullPolicy: Always env: - name: MYSQL_HOST value: database - name: MYSQL_DATABASE value: engelsystem - name: MYSQL_USER value: engelsystem - name: MYSQL_PASSWORD value: engelsystem - name: APP_URL value: - name: APP_NAME value: '' - image: name: engelsystem-nginx imagePullPolicy: Always env: - name: PHP_FPM_HOST value: localhost livenessProbe: httpGet: path: /health port: 80 --- apiVersion: v1 kind: Service metadata: name: engelsystem labels: app: environment: commit: '' annotations: prometheus.io/port: '80' prometheus.io/scrape: 'true' spec: type: ClusterIP ports: - port: 80 targetPort: 80 name: engelsystem selector: app: environment: tier: application --- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: engelsystem-ingress annotations: kubernetes.io/tls-acme: 'true' kubernetes.io/ingress.class: 'nginx' cert-manager.io/cluster-issuer: nginx.ingress.kubernetes.io/rewrite-target: /$1 labels: app: environment: commit: '' spec: tls: - hosts: - secretName: rules: - host: http: paths: - path: '/?(.*)' backend: serviceName: engelsystem servicePort: 80