# 先来看一下pod,发现没有运行
kubectl get pod | grep search
test-search-es-default-0 0/1 Running 0 16m
# 查看一下错误描述:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 30s (x2 over 30s) default-scheduler 0/2 nodes are available: 2 pod has unbound immediate PersistentVolumeClaims.
Normal Scheduled 27s default-scheduler Successfully assigned default/test-search-es-default-0 to 192.168.0.21
# 查看SC:nfs-client (default)
kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
managed-nfs-storage nfs-subdir-external-provisioner Delete Immediate false 224d
nfs-client (default) cluster.local/nfs-subdir-external-provisioner Delete Immediate true 239d
# 查看pvc,发现其状态是Bound
kubectl get pvc | grep ela
elasticsearch-data-test-search-es-default-0 Bound pvc-31dca991-52a2-46d8-8673-bd5aa7f7b959 1Gi RWO nfs-client 13m
# 再看pv
kubectl get pv | grep ela
pvc-31dca991-52a2-46d8-8673-bd5aa7f7b959 1Gi RWO Delete Bound default/elasticsearch-data-test-search-es-default-0 nfs-client 14m
结论:
看起来一切都是正常的,但是为什么会出现绑定错误呢?
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: test-search
spec:
version: 8.4.2
nodeSets:
- name: default
count: 1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: nfs-client
你使用的 nfs server 方式不支持 Dynamic Volume Provisioning,详见 https://stackoverflow.com/a/52669115/5989202