Where does the pod name come from in Helm?

7/31/2019

I just installed a kubernetes cluster by borrowing from helm/charts/stable/hadoop. Now all my pods have a prefix of "listening-snail"

Where did this come from? I am searching hi and low in all configuration files and I cannot find anything. Of course I didn't supply it on the commandline either!!!

$  helm install --namespace hadoopns hadoop 
NAME:   listening-snail
LAST DEPLOYED: Tue Jul 30 22:04:03 2019
NAMESPACE: hadoopns
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME                    DATA  AGE
listening-snail-hadoop  8     0s

==> v1/Pod(related)
NAME                              READY  STATUS             RESTARTS  AGE
listening-snail-hadoop-hdfs-dn-0  0/1    ContainerCreating  0         0s
listening-snail-hadoop-hdfs-nn-0  0/1    ContainerCreating  0         0s
listening-snail-hadoop-yarn-nm-0  0/1    ContainerCreating  0         0s
listening-snail-hadoop-yarn-rm-0  0/1    ContainerCreating  0         0s

...
-- Jeff Saremi
kubernetes-helm

1 Answer

7/31/2019

As described in this answer, listening-snail comes from your StatefulSet name.

StatefulSet name in charts/stable/hadoop's hdfs-dn-statefulset.yaml is

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: {{ include "hadoop.fullname" . }}-hdfs-dn

hadoop.fullname is defined in _helpers.tpl

 {{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "hadoop.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

So, if you don't supply --name parameter with your helm install command, it's random .Release.Name-hadoop generated by helm (where hadoop is .Chart.Name and can be overwritten by nameOverride in your values.yaml file).

Documentation

-- edbighead
Source: StackOverflow