# A headless service to create DNS records. apiVersion: v1 kind: Service metadata: name: {{ template "hdfs-k8s.namenode.fullname" . }} labels: app: {{ template "hdfs-k8s.namenode.name" . }} chart: {{ template "hdfs-k8s.subchart" . }} release: {{ .Release.Name }} spec: ports: - port: 8020 name: fs clusterIP: None selector: app: {{ template "hdfs-k8s.namenode.name" . }} release: {{ .Release.Name }} --- apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: {{ template "hdfs-k8s.namenode.fullname" . }} labels: app: {{ template "hdfs-k8s.namenode.name" . }} chart: {{ template "hdfs-k8s.subchart" . }} release: {{ .Release.Name }} spec: serviceName: {{ template "hdfs-k8s.namenode.fullname" . }} # Create a size-1 set. replicas: 1 template: metadata: labels: app: {{ template "hdfs-k8s.namenode.name" . }} release: {{ .Release.Name }} {{- if .Values.podAnnotations }} annotations: {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} spec: {{- if .Values.affinity }} affinity: {{ toYaml .Values.affinity | indent 8 }} {{- end }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} {{- if .Values.tolerations }} tolerations: {{ toYaml .Values.tolerations | indent 8 }} {{- end }} # Use hostNetwork so datanodes connect to namenode without going through an overlay network # like weave. Otherwise, namenode fails to see physical IP address of datanodes. hostNetwork: true hostPID: true dnsPolicy: ClusterFirstWithHostNet containers: - name: hdfs-namenode image: uhopper/hadoop-namenode:2.7.2 env: - name: HADOOP_CUSTOM_CONF_DIR value: /etc/hadoop-custom-conf - name: CLUSTER_NAME value: hdfs-k8s ports: - containerPort: 8020 name: fs volumeMounts: - name: hdfs-name mountPath: /hadoop/dfs/name - name: hdfs-config mountPath: /etc/hadoop-custom-conf readOnly: true restartPolicy: Always volumes: - name: hdfs-name hostPath: path: {{ .Values.nameNodeHostPath }} - name: hdfs-config configMap: name: {{ template "hdfs-k8s.config.fullname" . }}