forked from apache-spark-on-k8s/kubernetes-HDFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_hdfs_on_kube.sh
executable file
·36 lines (31 loc) · 1.41 KB
/
deploy_hdfs_on_kube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
echo "Creating service account for helm."
kubectl create -f installHelm/helm-account.yaml
helm init --service-account helm
# Get Kubernetes node list
k8s_node_list=`kubectl get nodes |grep '^gke-' |cut -d ' ' -f1`
echo "---------------------------------------------------------"
echo "Kubernetes node list is:"
echo "---------------------------------------------------------"
echo "$k8s_node_list"
echo "---------------------------------------------------------"
name_node=`echo $k8s_node_list | cut -d ' ' -f1`
echo "---------------------------------------------------------"
echo "Selected $name_node as HDFS name node."
echo "---------------------------------------------------------"
kubectl label nodes $name_node hdfs-namenode-selector=hdfs-namenode-0
kubectl label nodes $name_node hdfs-datanode-exclude=yes
# install configmap
cd charts
helm install hdfs-config-k8s --name my-hdfs-config --set fullnameOverride=hdfs-config
# install nn
echo "Deploying HDFS namenode."
helm install -n my-hdfs-namenode hdfs-simple-namenode-k8s
# install dn
echo "Deploying HDFS datanodes."
helm install -n my-hdfs-datanode hdfs-datanode-k8s
sleep 20
echo "HDFS deploy finished, please wait couple seconds for service startup..."
echo "You can check hdfs status by:"
echo "> kubectl exec -it hdfs-namenode-0 'hadoop dfsadmin -report'"
echo "> kubectl exec -it hdfs-namenode-0 'hdfs dfs -fs hdfs-namenode-0.hdfs-namenode:8020 -ls /'"