![默认 Grafana K8s 应用 PV 问题:FailedBinding persistentvolume-controller 此声明没有可用的持久卷,并且未设置存储类](https://linux22.com/image/779032/%E9%BB%98%E8%AE%A4%20Grafana%20K8s%20%E5%BA%94%E7%94%A8%20PV%20%E9%97%AE%E9%A2%98%EF%BC%9AFailedBinding%20persistentvolume-controller%20%E6%AD%A4%E5%A3%B0%E6%98%8E%E6%B2%A1%E6%9C%89%E5%8F%AF%E7%94%A8%E7%9A%84%E6%8C%81%E4%B9%85%E5%8D%B7%EF%BC%8C%E5%B9%B6%E4%B8%94%E6%9C%AA%E8%AE%BE%E7%BD%AE%E5%AD%98%E5%82%A8%E7%B1%BB.png)
我只是想按原样部署这个 Grafana 应用程序,没有对 YAML 进行任何更改:https://grafana.com/docs/grafana/latest/setup-grafana/installation/kubernetes/
虚拟机Ubuntu 20.04 LTS。Kubernetes 集群由 Control-Plane/Mstr 和 3x Worker 节点组成:
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
其他 K8s Pod(例如 NGINX)运行没有问题。
但是,Grafana pod 无法启动并且停留在 Pending 状态:
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
对此进行故障排除,我发现存储 PersistentVolumeClaim()存在问题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