<p>You can try below options to debug this further. </p>

<p>First verify <code>values.yaml</code> and check the values for <code>serviceAccount</code> (default value is true ) that means the helm chart when deployed will create a service account for the deployment. When you create a pod, <strong>if you do not specify a service account, it is automatically assigned the default service account in the given namespace</strong>. </p>

<pre><code>serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name:
</code></pre>

<p>Try to deploy your helm chart with create: false and verify if it solves your issue.</p>

<p>Else remove the file <code>hello-world/templates/serviceaccount.yaml</code> and mark serviceaccount as <code>create: false</code> in <code>value.yaml</code> and pass name as default service account of your deployment try to deploy as below</p>

<p>Note I have removed the <code>serviceaccount.yaml</code> </p>

<pre><code>~/hello$ tree
.
└── hello-world
    ├── charts
    ├── Chart.yaml
    ├── templates
    │   ├── deployment.yaml
    │   ├── _helpers.tpl
    │   ├── ingress.yaml
    │   ├── NOTES.txt
    │   ├── service.yaml
    │   └── tests
    │       └── test-connection.yaml
    └── values.yaml

4 directories, 8 files
</code></pre>

<p>set create field as false under <code>values.yaml</code></p>

<pre><code>$ cat hello-world/values.yaml | grep -i serviceaccount -A 10

serviceAccount:
  # Specifies whether a service account should be created
  create: false
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: default
</code></pre>

<p>You can fetch your list of serviceaccounts available as below</p>

<pre><code>$ kubectl get serviceaccounts
NAME      SECRETS   AGE
default   1         2d4h
</code></pre>

<p>Once deployed helm list will show the namespace used to deploy your chart and serviceaccount from the name space is used for deploeyemnt</p>

<pre><code>$ helm list
NAME                    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART               APP VERSION
hello-world-1580665905  default         1               2020-02-02 17:51:45.631330487 +0000 UTC deployed        hello-world-0.1.0   1.16.0
</code></pre>

<p>Get chart details and values post deploeyemtn as below </p>

<pre><code>$ helm show chart hello-world
apiVersion: v2
appVersion: 1.16.0
description: A Helm chart for Kubernetes
name: hello-world
type: application
version: 0.1.0

$ helm show values hello-world | grep -i serviceaccount -A 10
serviceAccount:
  # Specifies whether a service account should be created
  create: false
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: default

podSecurityContext: {}
  # fsGroup: 2000
</code></pre>

<p>Get deployed resources as below </p>

<pre><code>$ kubectl get all -o wide
NAME                                          READY   STATUS    RESTARTS   AGE    IP               NODE         NOMINATED NODE   READINESS GATES
pod/hello-world-1580665905-84b9d4d469-xv5mx   1/1     Running   0          118s   192.168.58.215   k8s-node02   &lt;none&gt;           &lt;none&gt;

NAME                             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE    SELECTOR
service/hello-world-1580665905   ClusterIP   10.108.73.21   &lt;none&gt;        80/TCP    118s   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world
service/kubernetes               ClusterIP   10.96.0.1      &lt;none&gt;        443/TCP   2d4h   &lt;none&gt;

NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS    IMAGES         SELECTOR
deployment.apps/hello-world-1580665905   1/1     1            1           118s   hello-world   nginx:1.16.0   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world

NAME                                                DESIRED   CURRENT   READY   AGE    CONTAINERS    IMAGES         SELECTOR
replicaset.apps/hello-world-1580665905-84b9d4d469   1         1         1       118s   hello-world   nginx:1.16.0   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world,pod-template-hash=84b9d4d469
</code></pre>

CC BY-SA 4.0
2020-02-03T11:59:19.203Z
Thanks for your thoughtful answer.
The issue was in the value.yaml.
Martin
CC BY-SA 4.0
2020-02-02T17:10:04.923Z
2020-02-04T17:32:53.237Z
2020-02-04T17:32:53.237Z
DT.
<p>Be aware that there you can have also this message with some charts when using helm 3 &lt; 3.7.0</p>
<p>Reference: <a href="https://github.com/nextcloud/helm/issues/163" rel="nofollow noreferrer">https://github.com/nextcloud/helm/issues/163</a></p>

CC BY-SA 4.0
2021-11-19T14:56:00.637Z
2021-11-20T13:49:16.457Z
2021-11-20T13:49:16.457Z
webofmars
<p>I'm really a beginner with kubernetes and really struggle with this simple tutorial from <a href="https://www.baeldung.com/kubernetes-helm" rel="noreferrer">baeldung.com</a></p>

<p>The only thing I did different (intentionally)  was using a google cloud cluster instead of minikube.</p>

<p>Basically this is what I did so far:</p>

<ol>
<li>Installed google cloud sdk.</li>
<li>Initialized gcloud with my google cloud cluster.</li>
<li>Installed helm.</li>
<li>Created helm charts like told in the tutorial.</li>
<li>Changed service.yaml, values.cyaml and deployment.yaml like told in the tutorial.</li>
</ol>

<p>And when I now run </p>

<pre><code>helm install hello-world .
</code></pre>

<p>I get this error message:</p>

<pre><code>Error: template: hello-world/templates/serviceaccount.yaml:1:14: executing "hello-world/templates/serviceaccount.yaml" at &lt;.Values.serviceAccount.create&gt;: nil pointer evaluating interface {}.create
</code></pre>

<p>To be honest I'm not even sure the serviceaccount.yaml is here for and I'm grateful for any advise!</p>

CC BY-SA 4.0
2020-01-30T21:45:15.267Z
try "helm install --name hello-world -f values.yaml ." in the root directory.
Pankaj Saini
<kubernetes><helm>
helm install causes nil pointer
Martin
# helm install causes nil pointer

(Asked by: username_0 on 2020-01-29)

I'm really a beginner with kubernetes and really struggle with this simple tutorial from baeldung.com
The only thing I did different (intentionally)  was using a google cloud cluster instead of minikube.
Basically this is what I did so far:

Installed google cloud sdk.
Initialized gcloud with my google cloud cluster.
Installed helm.
Created helm charts like told in the tutorial.
Changed service.yaml, values.cyaml and deployment.yaml like told in the tutorial.

And when I now run 
helm install hello-world .

I get this error message:
Error: template: hello-world/templates/serviceaccount.yaml:1:14: executing "hello-world/templates/serviceaccount.yaml" at <.Values.serviceAccount.create>: nil pointer evaluating interface {}.create

To be honest I'm not even sure the serviceaccount.yaml is here for and I'm grateful for any advise!

**Tags:** kubernetes, helm

> **Comments:**
> **username_1**: try "helm install --name hello-world -f values.yaml ." in the root directory.  

---

## 2 answers

### Answer by username_2 on 2020-02-02. Score: 1 | Accepted answer

You can try below options to debug this further. 
First verify values.yaml and check the values for serviceAccount (default value is true ) that means the helm chart when deployed will create a service account for the deployment. When you create a pod, if you do not specify a service account, it is automatically assigned the default service account in the given namespace. 
serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

Try to deploy your helm chart with create: false and verify if it solves your issue.
Else remove the file hello-world/templates/serviceaccount.yaml and mark serviceaccount as create: false in value.yaml and pass name as default service account of your deployment try to deploy as below
Note I have removed the serviceaccount.yaml 
~/hello$ tree
.
└── hello-world
    ├── charts
    ├── Chart.yaml
    ├── templates
    │   ├── deployment.yaml
    │   ├── _helpers.tpl
    │   ├── ingress.yaml
    │   ├── NOTES.txt
    │   ├── service.yaml
    │   └── tests
    │       └── test-connection.yaml
    └── values.yaml

4 directories, 8 files

set create field as false under values.yaml
$ cat hello-world/values.yaml | grep -i serviceaccount -A 10

serviceAccount:
  # Specifies whether a service account should be created
  create: false
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: default

You can fetch your list of serviceaccounts available as below
$ kubectl get serviceaccounts
NAME      SECRETS   AGE
default   1         2d4h

Once deployed helm list will show the namespace used to deploy your chart and serviceaccount from the name space is used for deploeyemnt
$ helm list
NAME                    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART               APP VERSION
hello-world-1580665905  default         1               2020-02-02 17:51:45.631330487 +0000 UTC deployed        hello-world-0.1.0   1.16.0

Get chart details and values post deploeyemtn as below 
$ helm show chart hello-world
apiVersion: v2
appVersion: 1.16.0
description: A Helm chart for Kubernetes
name: hello-world
type: application
version: 0.1.0

$ helm show values hello-world | grep -i serviceaccount -A 10
serviceAccount:
  # Specifies whether a service account should be created
  create: false
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: default

podSecurityContext: {}
  # fsGroup: 2000

Get deployed resources as below 
$ kubectl get all -o wide
NAME                                          READY   STATUS    RESTARTS   AGE    IP               NODE         NOMINATED NODE   READINESS GATES
pod/hello-world-1580665905-84b9d4d469-xv5mx   1/1     Running   0          118s   192.168.58.215   k8s-node02              

NAME                             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE    SELECTOR
service/hello-world-1580665905   ClusterIP   10.108.73.21           80/TCP    118s   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world
service/kubernetes               ClusterIP   10.96.0.1              443/TCP   2d4h   

NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS    IMAGES         SELECTOR
deployment.apps/hello-world-1580665905   1/1     1            1           118s   hello-world   nginx:1.16.0   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world

NAME                                                DESIRED   CURRENT   READY   AGE    CONTAINERS    IMAGES         SELECTOR
replicaset.apps/hello-world-1580665905-84b9d4d469   1         1         1       118s   hello-world   nginx:1.16.0   app.kubernetes.io/instance=hello-world-1580665905,app.kubernetes.io/name=hello-world,pod-template-hash=84b9d4d469

> **Comments:**
> **username_0**: Thanks for your thoughtful answer. The issue was in the value.yaml.  

---

### Answer by username_3 on 2021-11-19. Score: 0

Be aware that there you can have also this message with some charts when using helm 3 < 3.7.0

Reference: <https://github.com/nextcloud/helm/issues/163>


---

