apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx4
name: nginx4
spec:
containers:
- image: nginx
name: nginx4
nodeSelector:
app: "v1-tesla"
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Never
status: {}当我运行上面的模板kubectl create -f pod.yaml时,我得到以下错误:
error: error validating "podOnANode.yaml": error validating data:
ValidationError(Pod.spec.nodeSelector.resources): invalid type for
io.k8s.api.core.v1.PodSpec.nodeSelector: got "map", expected
"string"; if you choose to ignore these errors, turn validation off
with --validate=false任何解决这个问题的建议都是很棒的。
发布于 2019-01-18 20:31:19
上面的错误是针对:
nodeSelector:
app: "v1-tesla"
resources: {}这里是代表map的resources: {},但它应该是string。因此删除resources: {}或将其值更改为string。
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx4
name: nginx4
spec:
containers:
- image: nginx
name: nginx4
nodeSelector:
app: "v1-tesla"
resources: "whatever"
dnsPolicy: ClusterFirst
restartPolicy: Never
status: {}https://stackoverflow.com/questions/54253899
复制相似问题