0

I am simply trying to deploy this Grafana app as-is, no changes to the YAML have been made: https://grafana.com/docs/grafana/latest/setup-grafana/installation/kubernetes/

VMs are Ubuntu 20.04 LTS. The Kubernetes cluster is made up of the Control-Plane/Mstr & 3x Worker nodes:

root@k8s-master:~# kubectl get nodes
NAME          STATUS   ROLES           AGE     VERSION
k8s-master    Ready    control-plane   35d     v1.24.2
k8s-worker1   Ready    worker          4h24m   v1.24.2
k8s-worker2   Ready    worker          4h24m   v1.24.2
k8s-worker3   Ready    worker          4h24m   v1.24.2v

Other K8s Pods such as NGINX run without issue.

However, the Grafana pod cannot start and is stuck in a Pending state:

root@k8s-master:~# kubectl create -f grafana.yaml
persistentvolumeclaim/grafana-pvc created
deployment.apps/grafana created
service/grafana created
# time passed here...
root@k8s-master:~# kubectl get pods
NAME                                READY   STATUS    RESTARTS       AGE
grafana-9bd5bbd6b-k7ljz             0/1     Pending   0              3h39m

Troubleshooting this, I found there is an issue with the storage PersistentVolumeClaim (the pvc):

root@k8s-master:~# kubectl get pvc
NAME          STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
grafana-pvc   Pending                                                     2m22s
root@k8s-master:~#
root@k8s-master:~# kubectl describe pvc grafana-pvc
Name:          grafana-pvc
Namespace:     default
StorageClass:
Status:        Pending
Volume:
Labels:        <none>
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       grafana-9bd5bbd6b-k7ljz
Events:
  Type    Reason         Age                  From                         Message
  ----    ------         ----                 ----                         -------
  Normal  FailedBinding  6s (x11 over 2m30s)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set   

UPDATE: I created a StorageClass and set it as default:

root@k8s-master:~# kubectl get sc
NAME                PROVISIONER      RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
generic (default)   no-provisioner   Delete          Immediate           false                  19m

I also created a PersistentVolume:

root@k8s-master:~# kubectl get pv
NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                   STORAGECLASS   REASON   AGE
task-pv-volume   10Gi       RWO            Retain           Released   default/task-pv-claim   manual                  12m  

However, now when I try to deploy the Grafana PVC it is still stuck - why?

root@k8s-master:~# kubectl get pvc
NAME          STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
grafana-pvc   Pending                                      generic        4m16s
root@k8s-master:~# kubectl describe pvc grafana-pvc
Name:          grafana-pvc
Namespace:     default
StorageClass:  generic
Status:        Pending
Volume:
Labels:        <none>
Annotations:   volume.beta.kubernetes.io/storage-provisioner: no-provisioner
               volume.kubernetes.io/storage-provisioner: no-provisioner
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       grafana-9bd5bbd6b-mmqs6
               grafana-9bd5bbd6b-pvhtm
               grafana-9bd5bbd6b-rtwgj
Events:
  Type    Reason                Age                   From                         Message
  ----    ------                ----                  ----                         -------
  Normal  ExternalProvisioning  12s (x19 over 4m27s)  persistentvolume-controller  waiting for a volume to be created, either by external provisioner "no-provisioner" or manually created by system administrator
SamAndrew81
  • 152
  • 1
  • 10

1 Answers1

1

I have tried creating a Grafana configuration file from the documentation, and was able to create successfully. The pod has a Running state, also the PVC(PersistentVolumeClaim) shows the Storage class as standard.

The below is the output of PVC:

$ kubectl describe pvc grafana-pvc

Name:          grafana-pvc
Namespace:     default
StorageClass:  standard
Status:        Bound
Volume:        pvc-ee20cc5d-6ca5-4075-b5f3-d1a6323a5241
Labels:        <none>
Annotations:   pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
               volume.beta.kubernetes.io/storage-provisioner: pd.csi.storage.gke.io
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      1Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       grafana-75789d79d4-wbgtv
Events:        <none>

But in your use case the StorageClass field is showing as empty. So, try deleting the existing one and recreate the Grafana configuration file. If you were not able to create and are still facing the same error message which is “no persistent volumes available for this claim and no storage class is set” then you will have to create PV(PersistentVolume).

Because, your error says, "Your PVC hasn't found a matching PV and you also haven't mentioned any storageClass name". After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume with the same StorageClass, it binds the claim to the volume.

In order to resolve your issue you will need to create a StorageClass with no-provisioner and then create a PV(PersistentVolume) by defining this storageClassName. Then you have to create PVC and Pod/Deployment .

Refer to stackpost1 and stackpost2 for more information.

Jyothi Kiranmayi
  • 2,090
  • 5
  • 14