io.k8s.api.apps.v1.DeploymentSpec 中的未知字段 "resources"

unknown field "resources" in io.k8s.api.apps.v1.DeploymentSpec

_helper.tpl

{{- define "fluentd-config" -}}
image: {{ .Values.fluentd.kinesis_image }}
resources:
  limits:
    memory: 200Mi
  requests:
    cpu: 100m
    memory: 200Mi
{{- end -}}

deployment.yaml

- name: log-agent
  {{ include "fluentd-configuration" . | indent 2 }}

但是我遇到了,报错如下

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Deployment.spec): unknown field "resources" in io.k8s.api.apps.v1.DeploymentSpec

请告诉我为什么得到那个。谢谢。

您的部署文件应如下所示:

deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-name
  namespace: {{ .Release.Namespace }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      apps: my-demo-app # <-- here
  template:
    metadata:
      labels:
        apps: my-demo-app # <-- make sure it match the `matchLabels`
    spec:
      containers:
      - name: log-agent
{{include "fluentd-config" .| indent 8}} # (8 spaces added)