0

I'm trying to deploy mariadb-galera multimaster on kubernetes. But when I set external volume I receive this error:

mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied

this is my yaml:

# PersistentVolume
apiVersion: v1
kind: PersistentVolume
metadata:
  name: datadir-galera-0
  namespace: mon-zabbix
  labels:
    app: galera-ss
    podindex: "0"
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: /var/openebs/galera-0/datadir
---
# Persistent Volumes Claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-datadir-galera-ss-0
  namespace: mon-zabbix
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  selector:
    matchLabels:
      app: galera-ss
      podindex: "0"
# Service
apiVersion: v1
kind: Service
metadata:
  name: galera-ss
  namespace: mon-zabbix
spec:
  clusterIP: None
  ports:
  - name: mysql
    port: 3306
  selector:
    app: galera-ss
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: galera-ss
  namespace: mon-zabbix
spec:
  serviceName: galera-ss
  replicas: 3
  selector:
    matchLabels:
      app: galera-ss
  template:
    metadata:
      labels:
        app: galera-ss
    spec:
      containers:
      - name: galera
        image: bitnami/mariadb-galera:latest
        ports:
        - containerPort: 3306
        env:
        - name: MARIADB_ROOT_PASSWORD
          valueFrom:
              secretKeyRef:
                name: secrets
                key: MYSQL_ROOT_PASSWORD
        - name: MARIADB_GALERA_CLUSTER_NAME
          valueFrom:
              configMapKeyRef:
                key: CLUSTER_NAME
                name: configmap
        - name: MARIADB_GALERA_NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: MARIADB_GALERA_CLUSTER_BOOTSTRAP
          value: "yes"
        - name: MARIADB_GALERA_NODE_ADDRESS
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: MARIADB_GALERA_CLUSTER_ADDRESS
          value: "galera-ss.default.svc.cluster.local"
        - name: MARIADB_GALERA_MARIABACKUP_PASSWORD
          valueFrom:
              secretKeyRef:
                name: secrets
                key: XTRABACKUP_PASSWORD
        volumeMounts:
        - name: mysql-datadir
          mountPath: /bitnami/mariadb
        securityContext:
          allowPrivilegeEscalation: false
  volumeClaimTemplates:
  - metadata:
      name: mysql-datadir
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi

I tried to fix using the solutions find in other posts but it doesn't works for me. I'm using talos to create the kubernetes cluster (v1.28.0)

Could someone show how can I fix it, please?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.