【发布时间】:2019-07-05 10:11:54
【问题描述】:
我正在使用Azure Devops,并在io.k8s.api.core.v1.PodSpec 中获取未知字段imagePullPolicy"helm install:
2019-07-05T10:49:11.0064690Z ##[警告]找不到 ##vso[telemetry.command] 的命令扩展。请参考文档 (http://go.microsoft.com/fwlink/?LinkId=817296)
2019-07-05T09:56:41.1837910Z 错误:验证失败:错误验证“”:错误验证数据:ValidationError(Deployment.spec.template.spec):io.k8s.api 中的未知字段“imagePullPolicy”。 core.v1.PodSpec
2019-07-05T09:56:41.1980030Z ##[错误]错误:验证失败:错误验证“”:错误验证数据:ValidationError(Deployment.spec.template.spec):io中的未知字段“imagePullPolicy” .k8s.api.core.v1.PodSpec
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "clusterfitusecaseapihelm.fullname" . }}
labels:
{{ include "clusterfitusecaseapihelm.labels" . | indent 4 }}
spec:
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: {{ include "clusterfitusecaseapihelm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "clusterfitusecaseapihelm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
name: {{ .Chart.Name }}
env:
- name: ASPNETCORE_ENVIRONMENT
value: {{ .Values.environment }}
resources:
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
livenessProbe:
httpGet:
path: /api/version
port: 80
initialDelaySeconds: 90
timeoutSeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /api/version
port: 80
initialDelaySeconds: 30
timeoutSeconds: 10
periodSeconds: 15
ports:
- containerPort: 80
name: http
volumeMounts:
- mountPath: /app/config
name: {{ include "clusterfitusecaseapihelm.name" . }}
readOnly: true
volumes:
- name: {{ include "clusterfitusecaseapihelm.name" . }}
imagePullPolicy: Always
imagePullSecrets:
- name: regsecret
也试过了,但失败了:
【问题讨论】:
-
我已经安装了helm 2.14.1版
-
显示 pod 清单,但我认为它不应该在规范之下,它应该在 spec.containers 之下
-
在我的本地 kubernetes 集群 (docker-for-desktop) 上,它工作正常。
-
看起来对齐/位置问题 -
imagePullPolicy: Always应该在容器:标签下,图像旁边:。 -
看图片,它已经在容器下面了。
标签: kubernetes kubernetes-helm kubernetes-ingress azure-aks