<p>I have a simple helm chart that will deploy an application to my local copy of kubernetes via docker desktop. If I use kubectl to deploy the yaml one file at a time things work correctly. However, when I try to create a helm chart for easier deployments I get the following error.</p>
<blockquote>
<p>helm install demo WebApi</p>
</blockquote>
<blockquote>
<p>Error: unable to build kubernetes objects from release manifest: error validating &quot;&quot;: error validating data: apiVersion not set</p>
</blockquote>
<p>The error seems to be saying that I am missing an apiVersion map in one or more of my YAML files. However, all of my files have what seems to be the correct apiVersions.</p>
<p><strong>Folder Structure</strong></p>
<pre><code>charts
└── WebApi
    ├── Chart.yaml
    └── templates
        ├── deployment.yaml
        ├── ingress.yaml
        └── services.yaml
</code></pre>
<p><strong>Chart.yaml</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v2
version: 0.1.0
name: WebApi
appVersion: &quot;1.0&quot;
description: A Helm Chart for WebApi
type: application
</code></pre>
<p><strong>deployment.yaml</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-api
  labels:
    app: demo
    tier: demo-api
spec:
  selector:
    matchLabels:
      app: demo
  replicas: 3
  template:
    metadata:
      labels:
        app: demo
    spec:
      containers:
        - name: demo
          image: demo/image
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 80
              protocol: TCP
          resources:
            limits:
              memory: &quot;128Mi&quot; #128 MB
              cpu: &quot;200m&quot; #200 millicpu (.2 cpu or 20% of the cpu)
          livenessProbe:
            httpGet:
              path: /swagger/index.html
              port: 80
            initialDelaySeconds: 15
            timeoutSeconds: 2
            periodSeconds: 5
            failureThreshold: 1
          readinessProbe:
            httpGet:
              path: /swagger/index.html
              port: 80
</code></pre>
<p><strong>ingress.yaml</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: demo
spec:
  rules:
    - host: demo.com
      http:
        paths:
          - backend:
              serviceName: demo
              servicePort: 80
</code></pre>
<p><strong>service.yaml</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: demo
  labels:
    app: demo
spec:
  type: ClusterIP
  selector:
    app: demo
  ports:
    - name: http
      port: 80
      targetPort: 80
</code></pre>
<p>As you can see all of my YAML files have the required apiVersion map however the error still says they are missing. What corrections do I need to make in order for this to work as intended?</p>

<p>I had a similar problem with the same error message, but not exactly the same problem.  The problem for me seems to have been a comment at the start of one of the helm templates.  It seems helm did not handle this case well.  When i moved the comment down a bit it worked.</p>
