我的pod处于挂起状态。我正在kubernetes中部署jenkins pod,当我描述pod时,我收到以下错误
error:error validating“pv.yml”:验证数据时出错:[ValidationError(PersistentVolume.spec.accessModes):io.k8s.api.core.v1.PersistentVolumeSpec.accessModes的类型无效:得到“string”,预期为“array”,ValidationError(PersistentVolume.spec.nodeAffinity.required.nodeSelectorTerms):io.k8s.api.core.v1.NodeSelector.nodeSelectorTerms的类型无效:得到“map”,预期为“array”];如果选择忽略这些错误,请使用--validate=false关闭验证
我的vc.Yml文件
apiVersion: v1
kind: PersistentVolume
metadata:
name: jenkins-pv-volume
labels:
type: local
spec:
storageClassName: jenkins-storage
claimRef:
name: jenkins-pv-claim
namespace: jenkins
capacity:
storage: 10Gi
accessModes:
ReadWriteOnce
hostPath:
path: /mnt/jenkins-vol
nodeAffinity:
required:
nodeSelectorTerms:
matchExpressions:
key: kubernetes.io/hostname
operator: In
values: central-harbor
请咨询
1条答案
按热度按时间fcwjkofz1#
只需修改
accessModes
的定义如下:设置
accessModes
需要和array
,而不是string
。请参阅Kubernetes文档中的示例。