<p>'I have created a helm chart using  <code>helm create &lt;chart-name&gt;</code></p>
<p>In values.yaml I added the following map and array</p>
<pre><code>nodeSelector:
  instance-type: &quot;re&quot;

tolerations:
  - key: &quot;re&quot;
    operator: &quot;Equal&quot;
    value: &quot;true&quot;
    effect: &quot;NoSchedule&quot;
</code></pre>
<p>I am trying to import these in templates/deployment.yaml The config over there looks like with the right indentation</p>
<pre><code>apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ include &quot;dummy-app.fullname&quot; . }}
  labels:
    app.kubernetes.io/name: {{ include &quot;dummy-app.name&quot; . }}
    helm.sh/chart: {{ include &quot;dummy-app.chart&quot; . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include &quot;dummy-app.name&quot; . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include &quot;dummy-app.name&quot; . }}
        app.kubernetes.io/instance: {{ .Release.Name }}
        log_group_name: {{ .Values.logging.log_group_name }}
      annotations:
        jitsi.io/metrics_path: {{.Values.service.metricsPath | default &quot;/actuator/prometheus&quot; | quote }}
        jitsi.io/scrape_port: {{.Values.service.actuatorPort | default &quot;8083&quot; | quote }}
        jitsi.io/should_be_scraped: {{.Values.service.shouldScrapp | default &quot;true&quot; | quote}}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag }}&quot;
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{.Values.service.targetPort}}
              protocol: TCP
            - name: http-actuator
              containerPort: {{.Values.service.actuatorPort}}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: http-actuator
            initialDelaySeconds: 30
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: http-actuator
            initialDelaySeconds: 30
          env:
            - name: PROFILES
              value: {{ required &quot;Environment name is required.&quot; .Values.env.environment | quote }}
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
    {{- with .Values.nodeSelector }}
    nodeSelector:
      {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
    affinity:
      {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
    tolerations:
      {{- toYaml . | nindent 8 }}
    {{- end }}
</code></pre>
<p>when I run this I get:</p>
<pre><code>Error: validation failed: error validating &quot;&quot;: error validating data: [ValidationError(Deployment.spec.template): unknown field &quot;nodeSelector&quot; in io.k8s.api.core.v1.PodTemplateSpec, ValidationError(Deployment.spec.template): unknown field &quot;tolerations&quot; in io.k8s.api.core.v1.PodTemplateSpec]
</code></pre>
<p>I tried many other ways but none seems to work. My guess is the array and map there is something I need to change in deployment.yaml but I can't figure out how</p>

user1995187
<p>It seems you're indenting wrongly <code>affinity</code>, <code>nodeSelector</code> and <code>tolerations</code>:</p>

<pre><code>apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ include "dummy-app.fullname" . }}
  labels:
    ...
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      ...
  template:
    metadata:
      labels:
        ...
      annotations:
        ...
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            ...
          livenessProbe:
            ...
          readinessProbe:
            ...
          env:
            ...
          resources:
            ...
    nodeSelector:  # &lt;&lt;&lt; this are at the same level of `spec`
      ...
    affinity:      # &lt;&lt;&lt; this are at the same level of `spec`
      ...
    tolerations:   # &lt;&lt;&lt; this are at the same level of `spec`
      ...
</code></pre>

<p>The following keys must be at the same level of containers, so indenting with additional two blank spaces should fix your issue.</p>
