我创建了两个PersistentVolumeClaims(一个用于Redis,一个用于持久日志),并尝试在单个部署中将它们装入,但是在创建部署后,出现以下错误:
nodes are available: 3 node(s) didn't match node selector, 4 node(s) had no available volume zone.
但是,只要我从部署yaml文件中删除一个PVC,它就可以正常工作。我正在使用Kubernetes引擎在Google Cloud Platform上运行它。
pvc1:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-log
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 20Gi
storageClassName: standard
pvc2:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-redis
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 20Gi
storageClassName: standard
部署:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: 'prod-deployment'
spec:
replicas: 1
template:
metadata:
labels:
app: foo
release: canary
environment: production
spec:
containers:
- name: api-server
image: 'foo:latest'
volumeMounts:
- mountPath: /logs
name: log-storage
- name: redis
image: 'redis'
volumeMounts:
- mountPath: /data
name: redis-data
volumes:
- name: redis-data
persistentVolumeClaim:
claimName: pvc-redis
- name: log-storage
persistentVolumeClaim:
claimName: pvc-log
答案 0 :(得分:3)
这类似于this。这很可能是由于PVC试图在没有节点的可用区上创建卷。您可以尝试将标准StorageClass
限制为仅具有Kubernetes节点的可用区。像这样:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
allowedTopologies:
- matchLabelExpressions:
- key: failure-domain.beta.kubernetes.io/zone
values:
- us-central1-a
- us-central1-b
答案 1 :(得分:0)
调度程序拒绝“ NoVolumeZoneConflict”谓词,这是声明: https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/algorithm/predicates/predicates.go#L564(因为我找不到更好的文档,但是我认为代码中的注释对此很清楚)。
正如Rico所说,您必须直接通过storageclass或pv限制pod中的卷的卷区,但不建议这样做。