Azure Devops Error : "unknown field "imagePullPolicy" in io.k8s.api.core.v1.PodSpec"

7/5/2019

I am using Azure Devops, and getting unknown field imagePullPolicy"in io.k8s.api.core.v1.PodSpec while doing helm install :

2019-07-05T10:49:11.0064690Z ##[warning]Can't find command extension for ##vso[telemetry.command]. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)

2019-07-05T09:56:41.1837910Z Error: validation failed: error validating "": error validating data: ValidationError(Deployment.spec.template.spec): unknown field "imagePullPolicy" in io.k8s.api.core.v1.PodSpec

2019-07-05T09:56:41.1980030Z ##[error]Error: validation failed: error validating "": error validating data: ValidationError(Deployment.spec.template.spec): unknown field "imagePullPolicy" in io.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

Tried this also but failed:

enter image description here

-- Vatan Soni
azure-aks
azure-kubernetes
kubernetes
kubernetes-helm
kubernetes-ingress

1 Answer

7/5/2019

imagePullPolicy is a property of a Container object, not a Pod object, so you need to move this setting inside the containers: list (next to image:).

-- David Maze
Source: StackOverflow