/
hdfs-multi-datanode-cluster.yml
135 lines (128 loc) · 3.71 KB
/
hdfs-multi-datanode-cluster.yml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This scripts creates one namenode and three datanode cluster.
# Service "hadoop" allow to access namenode from outside cluster and is sufficient to
# run tests using Dataflow runner(for Direct runner please use setup-all.sh script).
# Service "datanodes" allow to reach any datanode using its FQDN.
# StatefulSet "datanode" creates 3 replicas of hadoop datanode. Env variable NODE_TYPE
# is being used to autodetect by kubernetes pod his role in the cluster.
# Pod "namenode-0" is our master node - hadoop namenode. NODE_TYPE is set to namenode.
# Additionally we specify number of datanodes that namenode will provision with hdfs
# configuration and add to hadoop cluster by setting DATANODE_COUNT to 3.
# On Jenkins we run tests in namespaces. This value is passed to pod environment in
# NODE_NAMESPACE variable and being used to create list of FQDN of datanodes:
# datanode-x.hadoop-datanodes.NODE_NAMESPACE.svc.cluster.local
#
apiVersion: v1
kind: Service
metadata:
name: hadoop
labels:
name: hadoop
spec:
ports:
- name: hdfs
port: 9000
- name: web
port: 50070
selector:
name: namenode
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: hadoop-datanodes
spec:
selector:
name: datanode
clusterIP: None
ports:
- name: hdfs
port: 9000
targetPort: 9000
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: datanode
spec:
selector:
matchLabels:
name: datanode
serviceName: "hadoop-datanodes"
replicas: 3
template:
metadata:
labels:
name: datanode
spec:
containers:
- name: datanode
image: gcr.io/apache-beam-testing/kubernetes-hadoop:3.3.4
imagePullPolicy: Always
env:
- name: NODE_TYPE
value: datanode
ports:
- name: sshd
containerPort: 22
- name: namenode-hdfs
containerPort: 9000
- name: web
containerPort: 50070
- name: datanode
containerPort: 50010
- name: datanode-icp
containerPort: 50020
- name: datanode-http
containerPort: 50075
---
apiVersion: v1
kind: Pod
metadata:
name: namenode-0
labels:
name: namenode
spec:
hostname: namenode-0
subdomain: hadoop-namenodes
containers:
- image: gcr.io/apache-beam-testing/kubernetes-hadoop:3.3.4
imagePullPolicy: Always
name: namenode
env:
- name: NODE_TYPE
value: namenode
- name: DATANODE_COUNT
value: '3'
- name: NODE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: sshd
containerPort: 22
- name: namenode-hdfs
containerPort: 9000
- name: web
containerPort: 50070
- name: datanode
containerPort: 50010
- name: datanode-icp
containerPort: 50020
- name: datanode-http
containerPort: 50075