Skip to content

Commit 163ae1c

Browse files
author
dcapozzi
committed
replace hostPath with persistentVolumeClaims
1 parent df1c7fb commit 163ae1c

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

charts/hdfs-datanode-k8s/templates/datanode-daemonset.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@
1515

1616
# Deleting a daemonset may need some trick. See
1717
# https://github.com/kubernetes/kubernetes/issues/33245#issuecomment-261250489
18+
{{- range $index, $path := .Values.dataNodeHostPath }}
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
21+
metadata:
22+
# This name uniquely identifies the PVC. Will be used in deployment below.
23+
name: hdfs-data-volume-claim-{{ $index }}
24+
labels:
25+
app: hdfs-name-storage-claim-{{ $index }}
26+
spec:
27+
# Read more about access modes here: http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes
28+
accessModes:
29+
- ReadWriteOnce
30+
resources:
31+
# This is the request for storage. Should be available in the cluster.
32+
requests:
33+
storage: 5Gi
34+
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
35+
#storageClassName:
36+
---
37+
{{- end }}
1838
apiVersion: extensions/v1beta1
1939
kind: DaemonSet
2040
metadata:
@@ -175,8 +195,8 @@ spec:
175195
volumes:
176196
{{- range $index, $path := .Values.dataNodeHostPath }}
177197
- name: hdfs-data-{{ $index }}
178-
hostPath:
179-
path: {{ $path }}
198+
persistentVolumeClaim:
199+
claimName: hdfs-data-volume-claim-{{ $index }}
180200
{{- end }}
181201
{{- if .Values.kerberosEnabled }}
182202
- name: kerberos-config

charts/hdfs-simple-namenode-k8s/templates/namenode-statefulset.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ spec:
2828
selector:
2929
app: hdfs-namenode
3030
---
31+
apiVersion: v1
32+
kind: PersistentVolumeClaim
33+
metadata:
34+
# This name uniquely identifies the PVC. Will be used in deployment below.
35+
name: hdfs-name-volume-claim
36+
labels:
37+
app: hdfs-name-storage-claim
38+
spec:
39+
# Read more about access modes here: http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes
40+
accessModes:
41+
- ReadWriteOnce
42+
resources:
43+
# This is the request for storage. Should be available in the cluster.
44+
requests:
45+
storage: 5Gi
46+
# Uncomment and add storageClass specific to your requirements below. Read more https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1
47+
#storageClassName:
48+
---
3149
apiVersion: apps/v1beta1
3250
kind: StatefulSet
3351
metadata:
@@ -59,6 +77,8 @@ spec:
5977
{{- end }}
6078
- name: HDFS_CONF_dfs_namenode_datanode_registration_ip___hostname___check
6179
value: "false"
80+
- name: CORE_CONF_hadoop_http_staticuser_user
81+
value: root
6282
- name: CLUSTER_NAME
6383
value: hdfs-k8s
6484
ports:
@@ -74,5 +94,5 @@ spec:
7494
restartPolicy: Always
7595
volumes:
7696
- name: hdfs-name
77-
hostPath:
78-
path: {{ .Values.nameNodeHostPath }}
97+
persistentVolumeClaim:
98+
claimName: hdfs-name-volume-claim

0 commit comments

Comments
 (0)