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