pod 状态pending
kubectl describe pod xxx -n xx
0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.
## 配置如下
##########################
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv
namespace: kafka
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: manual
#nfs:
#path: /nfs/data
#server: 192.168.153.103
#readOnly: false
local:
path: /nfs/data
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- hadoop03
#######################
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-pvc
spec:
resources:
requests:
storage: 1Gi
accessModes:
- ReadWriteOnce
storageClassName: manual
########################
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-controller
spec:
replicas: 2
selector:
name: nginx
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: hadoop03:5000/nginx
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html
name: data-volume
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: test-pvc
########################
Warning FailedScheduling 59s default-scheduler 0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.
参考:https://stackoverflow/questions/63771336/cannot-get-pod-to-bind-local-storage-in-minikube-nodes-didnt-find-available
I think the issue is that one of mine was ReadWriteOnce and the other one was ReadWriteMany, then I had trouble getting permissions right when running minikube mount /tmp/data:/mnt/data so I just got rid of mounting it to the underlying filesystem and now it works
PV AccessModes 访问模式
ReadOnlyMany(ROX) 允许被多个节点以只读的模式进行挂载。
ReadWriteOnce(RWO)允许被单个节点以读写的模式进行挂载。
ReadWriteMany(RWX)允许被多个节点以读写的模式进行挂载。
尝试修改pv 、pvc 成同一个访问模式 ReadWriteMany:
[root@hadoop03 k8s]# kubectl get pvc -n kafka
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-pvc Bound pv 5Gi RWX manual 23m
[root@hadoop03 k8s]# kubectl get pv -n kafka
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pv 5Gi RWX Retain Bound kafka/test-pvc manual 178m
[root@hadoop03 k8s]#
更多推荐
0/1 nodes are available: 1 node(s) didn‘t find available persistent volumes to b
发布评论