1

While installing influxdb2 using k8s manifest from the link influxdb2 installation on k8s I get below "pod has unbound immediate PersistentVolumeClaims" error.

The instruction is given for minikube but I am installing it as a normal k8s cluster. Any idea about the issue and how to fix.

/home/ravi#kubectl describe pod influxdb-0 -n influxdb
Name:           influxdb-0
Namespace:      influxdb
Priority:       0
Node:           <none>
Labels:         app=influxdb
                controller-revision-hash=influxdb-78bc684b99
                statefulset.kubernetes.io/pod-name=influxdb-0
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  StatefulSet/influxdb
Containers:
  influxdb:
    Image:        influxdb:2.0.6
    Port:         8086/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /var/lib/influxdb2 from data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-k9d8t (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-influxdb-0
    ReadOnly:   false
  default-token-k9d8t:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-k9d8t
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>  default-scheduler  pod has unbound immediate PersistentVolumeClaims
/home/ravi#

influx db2 yaml file

---
apiVersion: v1
kind: Namespace
metadata:
    name: influxdb
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
    labels:
        app: influxdb
    name: influxdb
    namespace: influxdb
spec:
    replicas: 1
    selector:
        matchLabels:
            app: influxdb
    serviceName: influxdb
    template:
        metadata:
            labels:
                app: influxdb
        spec:
            containers:
              - image: influxdb:2.0.6
                name: influxdb
                ports:
                  - containerPort: 8086
                    name: influxdb
                volumeMounts:
                  - mountPath: /var/lib/influxdb2
                    name: data
    volumeClaimTemplates:
      - metadata:
            name: data
            namespace: influxdb
        spec:
            accessModes:
              - ReadWriteOnce
            resources:
                requests:
                    storage: 10G
---
apiVersion: v1
kind: Service
metadata:
    name: influxdb
    namespace: influxdb
spec:
    ports:
      - name: influxdb
        port: 8086
        targetPort: 8086
    selector:
        app: influxdb
    type: ClusterIP

k8s version

/home/ravi#kubectl  version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}


/home/ravi>sudo kubectl get pvc -A
NAMESPACE   NAME                      STATUS    VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS    AGE
influxdb    data-influxdb-0           Pending                                                                      4h41m
ricplt      pvc-ricplt-alarmmanager   Bound     pv-ricplt-alarmmanager   100Mi      RWO            local-storage   5h17m
ricplt      pvc-ricplt-e2term-alpha   Bound     pv-ricplt-e2term-alpha   100Mi      RWO            local-storage   5h18m
ricplt      r4-influxdb-influxdb2     Pending                                                                      32m
/home/ravi>
/home/ravi>
/home/ravi>

/home/ravi>sudo kubectl describe pvc data-influxdb-0 -n influxdb
Name:          data-influxdb-0
Namespace:     influxdb
StorageClass:  
Status:        Pending
Volume:        
Labels:        app=influxdb
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    influxdb-0
Events:
  Type    Reason         Age                       From                         Message
  ----    ------         ----                      ----                         -------
  Normal  FailedBinding  2m12s (x1021 over 4h17m)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set
/home/ravi>
  • is the PVC created ? if yes please share the output of `kubectl describe pvc` – akathimi Mar 14 '23 at 08:41
  • updated the output in the main thread as you asked. I see "no persistent volumes available for this claim and no storage class is set" how to fix this? – myquest5 sh Mar 14 '23 at 13:04
  • Hello @myquest5 sh, Feel free to update the status of the question. Let me know the answer below helps to resolve your issue? I am happy to help you if you have any further queries. – Veera Nagireddy Mar 28 '23 at 07:08

2 Answers2

1

Looks like there is no auto-provisioning of k8s cluster you are running. You need to create Persistent Volume & Storage classes on local clusters manually by cluster admin.

Create one provisioner and pass that to your storage class and give that storage class to a persistence volume template to create automatic PVC and PV.

Refer to official kubernetes documentation on Configure a Pod to Use a PersistentVolume for Storage, which may help to resolve your issue.

To configure a Pod to use a PersistentVolumeClaim for storage. Here is a summary of the process:

  1. You, as a cluster administrator, create a PersistentVolume backed by physical storage. You do not associate the volume with any Pod.

  2. You, now taking the role of a developer / cluster user, create a PersistentVolumeClaim that is automatically bound to a suitable PersistentVolume.

  3. You create a Pod that uses the above PersistentVolumeClaim for storage.

Also try changing accessModes: ReadWriteMany to volume accessed by all your pods. A subPath needs to be used, If each pod wants to have its own directory. Refer to official Kubernetes document on Using subPath, like below :

volumeMounts:
-  name: data
mountPath: /var/lib/influxdb2
subPath: $(POD_NAME)
Veera Nagireddy
  • 1,656
  • 1
  • 3
  • 12
  • As KMS mentioned, you can check CSI driver status with the command : **kubectl get csidriver**. Refer to similar [SO](https://stackoverflow.com/questions/52668938/pod-has-unbound-persistentvolumeclaims), which will help to resolve your issue quickly. – Veera Nagireddy Mar 16 '23 at 06:26
0

As @Akathimi commented, this is because of provisioner won't create any PD as the CSI driver is disabled.

KMS
  • 40
  • 4