Skip to content

Commit

Permalink
KUDU-2398: Kudu kubernetes statefulset manifest
Browse files Browse the repository at this point in the history
it builds kubernetes statefulset kudu cluster, statefulset manages the 
deployment and scaling of kudu server pods.
creating kubernetes kudu cluster: kubectl create -f kudu-statefulset.yaml
to destroy: kubectl delete -f kudu-statefulset.yaml
scale: kubectl scale statefulset kudu-tserver --replicas=5

Change-Id: I3f87a70b3c6ac87bc531306855c80011dce3a61d
Reviewed-on: http://gerrit.cloudera.org:8080/13407
Tested-by: Kudu Jenkins
Reviewed-by: Grant Henke <[email protected]>
  • Loading branch information
SandishKumarHN authored and granthenke committed Jun 4, 2019
1 parent c45002d commit fa17619
Showing 1 changed file with 212 additions and 0 deletions.
212 changes: 212 additions & 0 deletions kubernetes/kudu-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# 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.
#
# More about kubernetes statefulset https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
# build kudu docker image from ../docker folder: ../docker/docker-build.sh
# create statefulset kudu kubernetes cluster : kubectl create -f kudu-statefulset.yaml
# get kudu master url: minikube service kudu-master-ui --url
# scale kudu tserver cluster : kubectl scale statefulset kudu-tserver --replicas=5
# destroy kudu kubernetes cluster: kubectl delete -f kudu-statefulset.yaml

apiVersion: v1
kind: Service
metadata:
name: kudu-masters
labels:
app: kudu-master
spec:
clusterIP: None
ports:
- name: ui
port: 8051
- name: rpc-port
port: 8050
selector:
app: kudu-master
---
# headless service for masters
apiVersion: v1
kind: Service
metadata:
name: kudu-master-ui
labels:
app: kudu-master
spec:
clusterIP:
ports:
- name: ui
port: 8051
selector:
app: kudu-master
type: NodePort
target-port:
externalTrafficPolicy: Local
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kudu-master
labels:
app: kudu-master
spec:
serviceName: kudu-masters
podManagementPolicy: "Parallel"
replicas: 3
selector:
matchLabels:
app: kudu-master
template:
metadata:
labels:
app: kudu-master
spec:
containers:
- name: kudu-master
image: apache/kudu
imagePullPolicy: IfNotPresent
env:
- name: GET_HOSTS_FROM
value: dns
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: KUDU_MASTERS
value: "kudu-master-0.kudu-masters.default.svc.cluster.local,kudu-master-1.kudu-masters.default.svc.cluster.local,kudu-master-2.kudu-masters.default.svc.cluster.local"
args: ["master"]
ports:
- containerPort: 8050
name: master-ui
- containerPort: 8051
name: master-rpc
volumeMounts:
- name: datadir
mountPath: /mnt/data0
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kudu-master
topologyKey: kubernetes.io/hostname
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
storageClassName: standard

---
# headless service for tservers
apiVersion: v1
kind: Service
metadata:
name: kudu-tservers
namespace: default
labels:
app: kudu-tserver
spec:
clusterIP: None
ports:
- name: ui
port: 7050
- name: rpc-port
port: 7051
selector:
app: kudu-tserver
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kudu-tserver
labels:
app: kudu-tserver
spec:
serviceName: kudu-tservers
podManagementPolicy: "Parallel"
replicas: 3
selector:
matchLabels:
app: kudu-tserver
template:
metadata:
labels:
app: kudu-tserver
spec:
containers:
- name: kudu-tserver
image: apache/kudu
imagePullPolicy: IfNotPresent
env:
- name: GET_HOSTS_FROM
value: dns
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: KUDU_MASTERS
value: "kudu-master-0.kudu-masters.default.svc.cluster.local,kudu-master-1.kudu-masters.default.svc.cluster.local,kudu-master-2.kudu-masters.default.svc.cluster.local"
args: ["tserver"]
ports:
- containerPort: 7050
name: tserver-ui
- containerPort: 7051
name: tserver-rpc
volumeMounts:
- name: datadir
mountPath: /mnt/data0
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kudu-tserver
topologyKey: kubernetes.io/hostname
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
storageClassName: standard

0 comments on commit fa17619

Please sign in to comment.