Pod名称来自Helm?

时间:2019-07-31 05:23:44

标签: kubernetes-helm

我刚刚从helm/charts/stable/hadoop借来安装了kubernetes集群。 现在我所有的Pod的前缀都为“ listening-snail

这是从哪里来的?我在所有配置文件中搜索高低,但找不到任何东西。当然我也没有在命令行上提供它!!!

$  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

...

1 个答案:

答案 0 :(得分:1)

this answer中所述,listening-snail来自您的StatefulSet名称。

charts/stable/hadoop的{​​{3}}中的StatefulSet名称为

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

hadoop.fullnamehdfs-dn-statefulset.yaml

中定义
 {{/*
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 -}}

因此,如果您没有在--name命令中提供helm install参数,则它是由舵机生成的随机.Release.Name-hadoop(其中hadoop.Chart.Name,并且可以在您的 values.yaml 文件中被nameOverride覆盖。

_helpers.tpl