【问题标题】:Azure Devops Error : "unknown field "imagePullPolicy" in io.k8s.api.core.v1.PodSpec"Azure Devops 错误:“io.k8s.api.core.v1.PodSpec 中的未知字段“imagePullPolicy””
【发布时间】: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


【解决方案1】:

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

【讨论】:

  • 是的,它已经设置为容器属性,请再次检查我给定的 yaml。
  • 不,就像我说的应该在容器下,而不是规范
  • 实际上我使用了带有 kubernetes 扩展的 vs-code 默认生成的 sn-ps。在 vs 代码中使用 sn-ps 时需要小心。
猜你喜欢
  • 2019-07-06
  • 1970-01-01
  • 2021-11-22
  • 2021-02-26
  • 2019-06-20
  • 2023-03-15
  • 2020-03-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多