Persistent Volume Claim is not getting bound for AWS EBS volume

2/26/2021

I'm new to AWS EKS (Elastic Kubernetes Service). I'm trying to run SonarQube on EKS using Fargate profile (serverless).

Following are my Kubernetes manifests files:-

Deployment:-

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sonarqube
  name: sonarqube
  namespace: cicd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonarqube
  template:
    metadata:
      labels:
        app: sonarqube
    spec:
      containers:
        - name: sonarqube
          image: sonarqube:8.6.1-community
          resources:
            requests:
              cpu: 500m
              memory: 1024Mi
            limits:
              cpu: 2000m
              memory: 2048Mi
          volumeMounts:
          - mountPath: "/opt/sonarqube/data/"
            name: sonar-data
          - mountPath: "/opt/sonarqube/extensions/"
            name: sonar-extensions
          env:
          - name: "SONARQUBE_JDBC_USERNAME"
            valueFrom:
             configMapKeyRef:
               name: configuration
               key: USERNAME
          - name: "SONARQUBE_JDBC_URL"
            valueFrom:
             configMapKeyRef:
               name: configuration
               key: URL
          - name: "SONARQUBE_JDBC_PASSWORD"
            valueFrom:
              secretKeyRef:
                name: db-password
                key: password
          ports:
          - containerPort: 9000
            protocol: TCP
      volumes:
      - name: sonar-data
        persistentVolumeClaim:
          claimName: ebs-claim-sonar-data
      - name: sonar-extensions
        persistentVolumeClaim:
          claimName: ebs-claim-sonar-extensions

Storage Classes for Sonar data and Sonar extensions:-

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ebs-sc-sonar-data
  namespace: cicd
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ebs-sc-sonar-extensions
  namespace: cicd
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer

My Persistent Volume Claims (PVC):-

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim-sonar-data
  namespace: cicd
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ebs-sc-sonar-data
  resources:
    requests:
      storage: 100Gi

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim-sonar-extensions
  namespace: cicd
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ebs-sc-sonar-extensions
  resources:
    requests:
      storage: 50Gi

Please ignore the config maps and secrets. The problem is PVC is not getting bound with the Storage Class hence the deployment is failing with the below error:-

Pod not supported on Fargate: volumes not supported: sonar-data not supported because PVC ebs-claim-sonar-data not bound, sonar-extensions not supported because: PVC ebs-claim-sonar-extensions not bound

I tried to debug a lot but not able to understand the root cause. I would really appreciate it if someone can help me with this.

Also just want to check if run just my storage class object using the kubectl create -f <sc file> then I guess I should be able to see any EBS volumes getting provisioned on the AWS console, right?

Please assist, thanks

-- vinod827
amazon-eks
aws-fargate
kubernetes
sonarqube

0 Answers