1

_helper.tpl

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

部署.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

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

4

1 回答 1

2

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

部署.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) 
于 2020-09-25T13:11:57.123 回答