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

时间:2019-07-05 10:11:54

标签: kubernetes kubernetes-helm kubernetes-ingress azure-aks azure-kubernetes

我正在使用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中的未知字段“ 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

enter image description here

  

也尝试过此操作,但失败了:

enter image description here

1 个答案:

答案 0 :(得分:2)

imagePullPolicyContainer object的属性,而不是Pod对象,因此您需要将此设置移至containers:列表内(image:之后)。 / p>