2
respostas

Pod statefulset-mysql-0 pending e persistentvolumeclaim "configuracao-mysql" not found

Executei: kubectl create -f statefulset.yaml , kubectl create -f servico-banco.yaml, e kubectl create -f permissoes.yaml. Mas o 'pod statefulset-mysql-0' gerado ficou pendente. O dashboard mostra a 'persistentvolumeclaim "configuracao-mysql" not found'. Nos eventos do POD também mostra: 'error getting PVC "default/configuracao-mysql": could not find v1.PersistentVolumeClaim "default/configuracao-mysql"' e 'pod has unbound immediate PersistentVolumeClaims'. Como posso resolver esse problema?

2 respostas

Como está seu statefulset.yaml ?

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: statefulset-mysql
spec:
  serviceName: db
  template:
    metadata:
      labels:
       name: mysql
    spec:
      containers:
        - name: container-mysql
          image: mysql:5.7.19
          ports:
            - containerPort: 3306
          env:
            - name: MYSQL_DATABASE
              value: "loja"
            - name: MYSQL_USER
              value: "root"
            - name: MYSQL_ALLOW_EMPTY_PASSWORD
              value: "1"
          volumeMounts:
            - name: volume-mysql
              mountPath: /var/lib/mysql
      volumes:
          - name: volume-mysql
            persistentVolumeClaim:
              claimName: configuracao-mysql