0

Below is the code for postgres statefulset. The ebs volume is getting attached but getting failed during mounting.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
spec:
  selector:
    matchLabels:
      type: DB
  serviceName: write-db-service
  replicas: 1
  template:
    metadata:
      labels:
        type: DB
    spec:
      containers:
      - name: postgres
        image: postgres
        ports:
        - containerPort: 5432
        envFrom:
        - secretRef:
            name: job-creds
        volumeMounts:
        - name: my-vol
          mountPath: /var/lib/postgresql/data
          subPath: postgres
  volumeClaimTemplates:
  - metadata:
      name: my-vol
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: aws-storage
      resources:
        requests:
          storage: 3Gi

Events:
  Type     Reason                  Age                 From                     Message
  ----     ------                  ----                ----                     -------
  Normal   Scheduled               115s                default-scheduler        Successfully assigned default/postgres-0 to minikube
  Normal   SuccessfulAttachVolume  111s                attachdetach-controller  AttachVolume.Attach succeeded for volume "pvc-3db94a61-d6ea-4eab-84ab-c3cda450aea9"
  Warning  FailedMount             41s (x8 over 105s)  kubelet                  MountVolume.MountDevice failed for volume "pvc-3db94a61-d6ea-4eab-84ab-c3cda450aea9" : rpc error: code = Internal desc = Failed to find device path /dev/xvdba. no device path for device "/dev/xvdba" volume "vol-0e50e939b9ad9bc71" found!

0 Answers0