diff --git a/02_hetzner/00_infra/mariadb/deployment.yaml b/02_hetzner/00_infra/mariadb/deployment.yaml new file mode 100644 index 0000000..f9e0d93 --- /dev/null +++ b/02_hetzner/00_infra/mariadb/deployment.yaml @@ -0,0 +1,89 @@ +# Deployment description +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mariadb-deployment + namespace: infra-environment + labels: + app: mariadb-infra +spec: + strategy: + type: Recreate + replicas: 1 + selector: + matchLabels: + app: mariadb-infra + template: + metadata: + labels: + app: mariadb-infra + spec: + containers: + - name: mariadb + image: mariadb:10.7.1 + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "4" + ports: + - containerPort: 3306 + envFrom: + - configMapRef: + name: mariadb-config + volumeMounts: + - mountPath: /var/lib/mysql + name: mariadb-pv-infra + subPath: mariadb + volumes: + - name: mariadb-pv-infra + persistentVolumeClaim: + claimName: mariadb-pvc-infra +--- +# Persistent Volume Claim description +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mariadb-pvc-infra + namespace: infra-environment + labels: + app: mariadb-infra +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi +--- +# ConfigMap description +apiVersion: v1 +kind: ConfigMap +metadata: + name: mariadb-config + namespace: infra-environment + labels: + app: mariadb-infra +data: + MYSQL_ROOT_PASSWORD: a+p($y=6Q]^)UVVHa- + MYSQL_DATABASE: mariadb + MYSQL_USER: mysqluser + MYSQL_PASSWORD: Vy4U]C?tZFR~\a^gQN +--- +# mariadb StatefulSet Service +apiVersion: v1 +kind: Service +metadata: + name: mariadb-infra + namespace: infra-environment +spec: + selector: + app: mariadb-infra + type: LoadBalancer + ports: + - port: 3306 + targetPort: 3306 + +--- \ No newline at end of file