gpt4 book ai didi

Kubernetes deployment unknown field "spec.template.spec.volumes[0].PersistentVolumeClaim"(库伯内斯部署未知字段“spec.template.spec.volumes[0].PersistentVolumeClaim”)

转载 作者:bug小助手 更新时间:2023-10-28 10:35:53 31 4
gpt4 key购买 nike



Hi got a YAML that seems valid to me but it does not work when applying it and I can't figure out what is wrong with it

Hi得到了一个对我来说似乎有效的YAML,但当应用它时它不起作用,我不知道它有什么问题


error:

错误:


unknown field "spec.template.spec.volumes[0].PersistentVolumeClaim"

kubeval deployment.yaml passes with no errors

Kubeval部署.yaml通过,没有错误


apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-service
namespace: app-1-0
labels:
app: app-service
spec:
replicas: 1
selector:
matchLabels:
app: my-service
template:
metadata:
labels:
app: my-service
spec:
containers:
- name: my-service
image: registry.azurecr.io/app/app-service:1.0
env:
- name: AzureAd__Instance
value: ...
- name: AzureAd__ClientId
value: ...
- name: AzureAd__TenantId
value: ...
imagePullPolicy: Always
ports:
- containerPort: 8080
name: http
volumeMounts:
- mountPath: "/mnt/data"
name: cache
dnsPolicy: ClusterFirst
volumes:
- name: cache
PersistentVolumeClaim:
claimName: app-pvc

更多回答

you need to define filed in camelcase as in everywhere persistentVolumeClaim

您需要将CamelCase中的FIELD定义为Everywhere PersistentVolumeClaim

优秀答案推荐

Note that persistentVolumeClaim should be lowercased and specified as a nested object under volumes.

请注意,PersistentVolumeClaim应该是小写的,并指定为卷下的嵌套对象。


volumes:
- name: cache
persistentVolumeClaim:
claimName: app-pvc

更多回答

31 4 0