Azure Devops 错误:io.k8s.api.core.v1.PodSpec 中的“未知字段”imagePullPolicy”

Vat*_*oni -1 kubernetes kubernetes-helm kubernetes-ingress azure-aks

我正在使用Azure Devops,并imagePullPolicy"io.k8s.api.core.v1.PodSpec执行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.core.v1 中的未知字段“imagePullPolicy” .PodSpec

2019-07-05T09:56:41.1980030Z ##[错误]错误:验证失败:错误验证“”:错误验证数据:ValidationError(Deployment.spec.template.spec):io.k8s中的未知字段“imagePullPolicy”。 api.core.v1.PodSpec

部署.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
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

也试过这个但失败了:

在此处输入图片说明

Dav*_*aze 5

imagePullPolicyContainer 对象的属性,而不是 Pod 对象,因此您需要将此设置移动到containers:列表内(在 旁边image:)。