diff --git a/.helmignore b/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..f0c13194444163d1cba5c67d9e79231a62bc8f44 --- /dev/null +++ b/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/Deploy.md b/Deploy.md deleted file mode 100644 index 5049f38348a3aed593de1b565def9aceae94bec5..0000000000000000000000000000000000000000 --- a/Deploy.md +++ /dev/null @@ -1,28 +0,0 @@ -# pull images -docker pull danisla/hadoop:2.7.3 && docker tag danisla/hadoop:2.7.3 registry.cn-qingdao.aliyuncs.com/wod/hadoop:2.7.3 && \ -docker push registry.cn-qingdao.aliyuncs.com/wod/hadoop:2.7.3 - -docker pull 33098876/hbase:latest && docker tag 33098876/hbase:latest registry.cn-qingdao.aliyuncs.com/wod/hbase:latest && \ -docker push registry.cn-qingdao.aliyuncs.com/wod/hbase:latest - -## install - -```bashhbase -# install -安装zookeeper。 - - -#安装hbase - -helm install \ -/etc/kubernetes/helm/hbase \ ---name=hbase \ ---namespace=default \ --f /etc/kubernetes/helm/hbase/values-overrides.yaml - -# uninstall -helm delete hbase --purge - -# update -helm upgrade hbase /etc/kubernetes/helm/hbase \ --f /etc/kubernetes/helm/hbase/values-overrides.yaml diff --git a/README.md b/README.md index 069d0a504d17007da493776f1eb4dcad9b8a4155..f828b5f19d8a6a97a9c94524b07738ac3b5e58cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,54 @@ +# HBase chart + +Original chart from [warp-poke/hbase-helm](https://github.com/warp-poke/hbase-helm), modified to work with [chenseanxy/helm-hadoop-3](https://github.com/chenseanxy/helm-hadoop-3) chart. + +Current Version: HBase 2.1.7 based on Hadoop 3.1.2 +For HBase 1 chart, use tag [1.4.10-hadoop3.1.2](https://github.com/chenseanxy/helm-hbase-chart/tree/1.4.10-hadoop3.1.2) + +A chart to deploy Hbase with Hadoop using Kubernetes. Heavily inspired by the [Hadoop chart](https://github.com/kubernetes/charts/tree/master/stable/hadoop). + ## Getting started -``` -helm install --name myzk incubator/zookeeper --set servers=1,heap="1G" -helm del --purge hbase;helm install . --name hbase -``` + +You need: + +* Kubernetes +* [Helm](https://helm.sh/) + +Required charts: + + * Zookeeper: `incubator/zookeeper` from helm/charts + + * Hadoop: `chenseanxy/helm-hadoop-3` from [here](https://github.com/chenseanxy/helm-hadoop-3) + +## Config + +In `values.yaml`: + +`hbase.hdfs.name`, `hbase.hdfs.release`: point to your Hadoop deployment + +`hbase.zookeeper.quorum`: Zookeeper address:port + +## Architecture + +This chart is using several functionalities from Kubernetes. + +* [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/): at first, it is used as key-value to store elements. Here, we are using it to store config files. Furthermore, we are using it to inject a boostrap.sh to start our container. + + * For every container, we are mouting a container in /tmp based on the content of the ConfigMap (one entry == one file). + * Entrypoint for every component is the bash called `bootstrap.sh`, which is hold by the ConfigMap. + * `bootstrap.sh` is copying the files in the ConfigMap to the right location, starting the daemon and tail the logs + +* [Headless Service](https://kubernetes.io/docs/concepts/services-networking/service/#headless-services): In Kubernetes, every request to a pod a loadbalanced through a proxy by default. But Hbase is directly trying to connect to the RS, so by enabling headless mode, we can directly access the RS container. + +* [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/): it is used to deploy stateful applications to Kubernetes. + +* [PodDisruptionBudget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/): Allow user to define policy on pod failure. + +* [PersistentVolumClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/): allows pod to have volumes for data. Used for HDFS. + +There's a YAML per role and per functionality. Binding is done through [Selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). + +## TODO + +* Namenode HA +* Hbase Master HA \ No newline at end of file diff --git a/image/.gitignore b/image/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f995dfb177e6236a83a5844310b75f045ec88585 --- /dev/null +++ b/image/.gitignore @@ -0,0 +1,3 @@ +*.tar +*.tar.gz +*.tar.bz2 diff --git a/image/Dockerfile b/image/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..49059705ad62f13b874e67cf8341fff3224b9923 --- /dev/null +++ b/image/Dockerfile @@ -0,0 +1,12 @@ + +FROM chenseanxy/hadoop:3.2.1-nolib + +ARG VERSION= + +ADD hbase-${VERSION}-bin.tar.gz /opt + +RUN cd /opt && ln -s ./hbase-${VERSION} hbase && \ + cp hbase/lib/client-facing-thirdparty/htrace-core-3.1.0-incubating.jar hbase/lib && \ + . + +WORKDIR /opt/hbase diff --git a/image/Makefile b/image/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c57d95ea96193e92cbed06a639aa9a841b13cc83 --- /dev/null +++ b/image/Makefile @@ -0,0 +1,33 @@ +.PHONY: build + +# Current apache hbase releases: http://hbase.apache.org/releases.html + +HADOOP_30_VERSION = 3.1.2 +HBASE_VERSION = 2.1.7 + +DOCKER = docker +DOCKER_REPO = chenseanxy/hbase + +all: build + +### Build hbase versioned images with native libs. +build: + $(DOCKER) build -t hbase:$(HBASE_VERSION)-hadoop$(HADOOP_30_VERSION) \ + --build-arg HADOOP_VERSION=$(HADOOP_30_VERSION) \ + --build-arg VERSION=$(HBASE_VERSION) \ + . + +tag: + $(DOCKER) tag \ + hbase:$(HBASE_VERSION)-hadoop$(HADOOP_30_VERSION) \ + $(DOCKER_REPO):$(HBASE_VERSION)-hadoop$(HADOOP_30_VERSION) + +push: + $(DOCKER) push $(DOCKER_REPO):$(HBASE_VERSION)-hadoop$(HADOOP_30_VERSION) + +### Fetch binary distribution +hbase-%-bin.tar.gz: + curl -LO http://archive.apache.org/dist/hbase/$(HBASE_VERSION)/hbase-$(HBASE_VERSION)-bin.tar.gz + +# Keep intermediate downloads. +.PRECIOUS: hbase-%-bin.tar.gz diff --git a/image/README.md b/image/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8daa9231217e756b4f843fbddd7135a9ba483ff4 --- /dev/null +++ b/image/README.md @@ -0,0 +1,7 @@ +# HBase Image + +Original Image: [PierreZ/hbase-docker](https://github.com/PierreZ/hbase-docker/tree/master/distributed-1.3.1-hadoop-2.7.3) + +Current Version: 2.1.7 based on Hadoop 3.1.2 (TAG: 2.1.7-hadoop3.1.2) + +Docker Hub: [chenseanxy/hbase](https://hub.docker.com/r/chenseanxy/hbase) diff --git a/step.yaml b/step.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c74bc11c7def92e6c9b076bdea5da92352305609 --- /dev/null +++ b/step.yaml @@ -0,0 +1,45 @@ +configInfo: + - name: hbaseImage + text: hbase镜像 + type: text + value: registry.cn-qingdao.aliyuncs.com/wod/hbase:2.1.7 + - name: hdfs.nameNode.resources + text: 资源限制 + type: resource + memory: "2048Mi" + cpu: "1000m + - name: hdfs.dataNode.replicas + text: dataNode个数 + type: text + value: 3 + - name: hdfs.dataNode.resources + text: 资源限制 + type: resource + memory: "2048Mi" + cpu: "1000m + - name: persistence.nameNode.storageSpec + text: nameNode存储类 + type: storage + storage: "50Gi" + value: "nfs-client" + - name: persistence.dataNode.storageSpec + text: dataNode存储类 + type: storage + storage: "200Gi" + value: "nfs-client" + - name: hbase.hmaster.replicas + text: hmaster个数 + type: text + value: 1 + - name: hbase.hdfs.name + text: hdfs名称 + type: text + value: hadoop + - name: hbase.hdfs.release + text: release + type: text + value: hadoop + - name: hbase.zookeeper.quorum + text: quorum + type: text + value: hadoop \ No newline at end of file diff --git a/templates/_helpers.yaml b/templates/_helpers.yaml index 31528af05c01429939eb67da2783b769ace2563c..fc7f6a503686c9d714353e00979ad2cb4d7af64e 100644 --- a/templates/_helpers.yaml +++ b/templates/_helpers.yaml @@ -1,14 +1,26 @@ {{/* vim: set filetype=mustache: */}} + {{/* Expand the name of the chart. */}} -{{- define "hadoop.name" -}} +{{- define "hbase.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* -Expand the name of the chart. +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. */}} -{{- define "hbase.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} \ No newline at end of file +{{- define "hbase.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/templates/hadoop-configmap.yaml b/templates/hadoop-configmap.yaml deleted file mode 100644 index b982ee349d1bcc0496cb3fd084e997e32b297a48..0000000000000000000000000000000000000000 --- a/templates/hadoop-configmap.yaml +++ /dev/null @@ -1,296 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: hadoop-configmap - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: - bootstrap.sh: | - #!/bin/bash - - : ${HADOOP_PREFIX:=/usr/local/hadoop} - - . $HADOOP_PREFIX/etc/hadoop/hadoop-env.sh - - # Directory to find config artifacts - CONFIG_DIR="/tmp/hadoop-config" - - # Copy config files from volume mount - - for f in slaves core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml; do - if [[ -e ${CONFIG_DIR}/$f ]]; then - cp ${CONFIG_DIR}/$f $HADOOP_PREFIX/etc/hadoop/$f - else - echo "ERROR: Could not find $f in $CONFIG_DIR" - exit 1 - fi - done - - # installing libraries if any - (resource urls added comma separated to the ACP system variable) - cd $HADOOP_PREFIX/share/hadoop/common ; for cp in ${ACP//,/ }; do echo == $cp; curl -LO $cp ; done; cd - - - if [[ "${HOSTNAME}" =~ "hdfs-nn" ]]; then - mkdir -p /root/hdfs/namenode - $HADOOP_PREFIX/bin/hdfs namenode -format -force -nonInteractive - sed -i s/{{ template "hbase.name" . }}-hdfs-nn/0.0.0.0/ /usr/local/hadoop/etc/hadoop/core-site.xml - $HADOOP_PREFIX/sbin/hadoop-daemon.sh start namenode - fi - - if [[ "${HOSTNAME}" =~ "hdfs-dn" ]]; then - mkdir -p /root/hdfs/datanode - - # wait up to 30 seconds for namenode - (while [[ $count -lt 15 && -z `curl -sf http://{{ template "hbase.name" . }}-hdfs-nn:50070` ]]; do ((count=count+1)) ; echo "Waiting for {{ template "hbase.name" . }}-hdfs-nn" ; sleep 2; done && [[ $count -lt 15 ]]) - [[ $? -ne 0 ]] && echo "Timeout waiting for hdfs-nn, exiting." && exit 1 - - $HADOOP_PREFIX/sbin/hadoop-daemon.sh start datanode - fi - - if [[ "${HOSTNAME}" =~ "yarn-rm" ]]; then - sed -i s/{{ template "hbase.name" . }}-yarn-rm/0.0.0.0/ $HADOOP_PREFIX/etc/hadoop/yarn-site.xml - cp ${CONFIG_DIR}/start-yarn-rm.sh $HADOOP_PREFIX/sbin/ - cd $HADOOP_PREFIX/sbin - chmod +x start-yarn-rm.sh - ./start-yarn-rm.sh - fi - - if [[ "${HOSTNAME}" =~ "yarn-nm" ]]; then - sed -i '/<\/configuration>/d' $HADOOP_PREFIX/etc/hadoop/yarn-site.xml - cat >> $HADOOP_PREFIX/etc/hadoop/yarn-site.xml <<- EOM - - yarn.nodemanager.resource.memory-mb - ${MY_MEM_LIMIT:-2048} - - - - yarn.nodemanager.resource.cpu-vcores - ${MY_CPU_LIMIT:-2} - - EOM - echo '' >> $HADOOP_PREFIX/etc/hadoop/yarn-site.xml - cp ${CONFIG_DIR}/start-yarn-nm.sh $HADOOP_PREFIX/sbin/ - cd $HADOOP_PREFIX/sbin - chmod +x start-yarn-nm.sh - - # wait up to 30 seconds for resourcemanager - (while [[ $count -lt 15 && -z `curl -sf http://{{ template "hbase.name" . }}-yarn-rm:8088/ws/v1/cluster/info` ]]; do ((count=count+1)) ; echo "Waiting for {{ template "hbase.name" . }}-yarn-rm" ; sleep 2; done && [[ $count -lt 15 ]]) - [[ $? -ne 0 ]] && echo "Timeout waiting for yarn-rm, exiting." && exit 1 - - ./start-yarn-nm.sh - fi - - if [[ $1 == "-d" ]]; then - until find ${HADOOP_PREFIX}/logs -mmin -1 | egrep -q '.*'; echo "`date`: Waiting for logs..." ; do sleep 2 ; done - tail -F ${HADOOP_PREFIX}/logs/* & - while true; do sleep 1000; done - fi - - if [[ $1 == "-bash" ]]; then - /bin/bash - fi - - core-site.xml: | - - - - - fs.defaultFS - hdfs://{{ template "hbase.name" . }}-hdfs-nn:9000/ - NameNode URI - - - - hdfs-site.xml: | - - - - - dfs.datanode.use.datanode.hostname - false - - - - dfs.client.use.datanode.hostname - false - - - - dfs.replication - 3 - - - - dfs.datanode.data.dir - file:///root/hdfs/datanode - DataNode directory - - - - dfs.namenode.name.dir - file:///root/hdfs/namenode - NameNode directory for namespace and transaction logs storage. - - - - dfs.namenode.datanode.registration.ip-hostname-check - false - - - - mapred-site.xml: | - - - - - - mapreduce.framework.name - yarn - - - mapreduce.jobhistory.address - {{ template "hbase.name" . }}-yarn-rm-0.{{ template "hbase.name" . }}-yarn-rm.{{ .Release.Namespace }}.svc.cluster.local:10020 - - - mapreduce.jobhistory.webapp.address - {{ template "hbase.name" . }}-yarn-rm-0.{{ template "hbase.name" . }}-yarn-rm.{{ .Release.Namespace }}.svc.cluster.local:19888 - - - - slaves: | - localhost - - start-yarn-nm.sh: | - #!/usr/bin/env bash - - # 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. - - - # Start all yarn daemons. Run this on master node. - - echo "starting yarn daemons" - - bin=`dirname "${BASH_SOURCE-$0}"` - bin=`cd "$bin"; pwd` - - DEFAULT_LIBEXEC_DIR="$bin"/../libexec - HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR} - . $HADOOP_LIBEXEC_DIR/yarn-config.sh - - # start resourceManager - # "$bin"/yarn-daemon.sh --config $YARN_CONF_DIR start resourcemanager - # start nodeManager - "$bin"/yarn-daemon.sh --config $YARN_CONF_DIR start nodemanager - # start proxyserver - #"$bin"/yarn-daemon.sh --config $YARN_CONF_DIR start proxyserver - - start-yarn-rm.sh: | - #!/usr/bin/env bash - - # 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. - - - # Start all yarn daemons. Run this on master node. - - echo "starting yarn daemons" - - bin=`dirname "${BASH_SOURCE-$0}"` - bin=`cd "$bin"; pwd` - - DEFAULT_LIBEXEC_DIR="$bin"/../libexec - HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR} - . $HADOOP_LIBEXEC_DIR/yarn-config.sh - - # start resourceManager - "$bin"/yarn-daemon.sh --config $YARN_CONF_DIR start resourcemanager - # start nodeManager - # "$bin"/yarn-daemons.sh --config $YARN_CONF_DIR start nodemanager - # start proxyserver - "$bin"/yarn-daemon.sh --config $YARN_CONF_DIR start proxyserver - - yarn-site.xml: | - - - - - - yarn.resourcemanager.hostname - {{ template "hbase.name" . }}-yarn-rm - - - - yarn.nodemanager.vmem-check-enabled - false - - - - yarn.nodemanager.aux-services - mapreduce_shuffle - - - - yarn.nodemanager.aux-services.mapreduce_shuffle.class - org.apache.hadoop.mapred.ShuffleHandler - - - - List of directories to store localized files in. - yarn.nodemanager.local-dirs - /var/lib/hadoop-yarn/cache/${user.name}/nm-local-dir - - - - Where to store container logs. - yarn.nodemanager.log-dirs - /var/log/hadoop-yarn/containers - - - - Where to aggregate logs to. - yarn.nodemanager.remote-app-log-dir - /var/log/hadoop-yarn/apps - - - - yarn.application.classpath - - /usr/local/hadoop/etc/hadoop, - /usr/local/hadoop/share/hadoop/common/*, - /usr/local/hadoop/share/hadoop/common/lib/*, - /usr/local/hadoop/share/hadoop/hdfs/*, - /usr/local/hadoop/share/hadoop/hdfs/lib/*, - /usr/local/hadoop/share/hadoop/mapreduce/*, - /usr/local/hadoop/share/hadoop/mapreduce/lib/*, - /usr/local/hadoop/share/hadoop/yarn/*, - /usr/local/hadoop/share/hadoop/yarn/lib/* - - - diff --git a/templates/hbase-configmap.yaml b/templates/hbase-configmap.yaml index 8fdaf676371ebda4fe9046edb4d0ce997104b20d..ae9446399f5097555100001d493e8b43a7cc076d 100644 --- a/templates/hbase-configmap.yaml +++ b/templates/hbase-configmap.yaml @@ -20,8 +20,16 @@ data: hbase.rootdir - hdfs://{{ template "hbase.name" . }}-hdfs-nn:9000/hbase + hdfs://{{ .Values.hbase.hdfs.name }}-hdfs-nn:9000/hbase + + hbase.unsafe.stream.capability.enforce + false + + + hbase.wal.provider + filesystem + hbase.cluster.distributed true @@ -64,4 +72,4 @@ data: /opt/hbase/bin/hbase-daemon.sh --config /opt/hbase/conf start regionserver fi - tail -f opt/hbase/logs/* \ No newline at end of file + tail -f /opt/hbase/logs/* diff --git a/templates/hbase-master-pdb.yaml b/templates/hbase-master-pdb.yaml index 9104fabdedc530e7594824ba617bbfbc168d1841..a31ab940a84324e3a0024cb1dcd64a2cd4779d97 100644 --- a/templates/hbase-master-pdb.yaml +++ b/templates/hbase-master-pdb.yaml @@ -1,9 +1,9 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: - name: {{ template "hbase.name" . }}-hbase-master + name: {{ template "hbase.fullname" . }}-master labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} @@ -11,7 +11,7 @@ metadata: spec: selector: matchLabels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} release: {{ .Release.Name }} component: hbase-master minAvailable: 1 # FIXME: HA? \ No newline at end of file diff --git a/templates/hbase-master-statefulset.yaml b/templates/hbase-master-statefulset.yaml index 64d6c9b965a6e84fcea8b09c4fe0f8988637b40b..43b1911c7dcd0e05594873929e3899502a6ca0a2 100644 --- a/templates/hbase-master-statefulset.yaml +++ b/templates/hbase-master-statefulset.yaml @@ -1,22 +1,20 @@ apiVersion: apps/v1beta1 kind: StatefulSet metadata: - name: {{ template "hbase.name" . }}-hbase-master - annotations: - checksum/config: {{ include (print $.Template.BasePath "/hadoop-configmap.yaml") . | sha256sum }} + name: {{ template "hbase.fullname" . }}-master labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: hbase-master spec: - serviceName: {{ template "hbase.name" . }}-hbase-master - replicas: {{ .Values.hbase.master.replicas }} + serviceName: {{ template "hbase.fullname" . }}-master + replicas: {{ .Values.hbase.hmaster.replicas }} template: metadata: labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} release: {{ .Release.Name }} component: hbase-master spec: @@ -25,44 +23,35 @@ spec: - topologyKey: "kubernetes.io/hostname" labelSelector: matchLabels: - app: {{ template "hadoop.name" . }} + app: {{ .Values.hbase.hdfs.name }} + release: {{ .Values.hbase.hdfs.release | quote }} + component: hdfs-nn terminationGracePeriodSeconds: 0 containers: - name: hbase-master - image: {{ .Values.hbaseimage.repository }}:{{ .Values.hbaseimage.tag }} - imagePullPolicy: {{ .Values.hbaseimage.pullPolicy }} - env: - - name: HBASE_SERVER_TYPE - value: hbase-master - - name: HDFS_PATH - value: {{ template "hbase.name" . }}-hdfs-nn:9000 - - name: ZOOKEEPER_SERVICE_LIST - value: {{ .Values.hbase.env.zookeeperServiceList }} - - name: ZOOKEEPER_PORT - value: "{{ .Values.hbase.env.zookeeperPort }}" - - name: ZNODE_PARENT - value: hbase - ports: - - name: port1 - containerPort: 16000 - protocol: TCP - - name: port2 - containerPort: 16010 - protocol: TCP + image: {{ .Values.hbaseImage }} + imagePullPolicy: {{ .Values.imagePullPolicy }} command: - - "/bin/bash" - - "/opt/hbase/bin/start-k8s-hbase.sh" + - "/bin/bash" + - "/tmp/hbase-config/bootstrap.sh" resources: -{{ toYaml .Values.hbase.master.resources | indent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} +{{ toYaml .Values.hdfs.nameNode.resources | indent 10 }} + readinessProbe: + httpGet: + path: / + port: 16010 + initialDelaySeconds: 5 + timeoutSeconds: 2 + livenessProbe: + httpGet: + path: / + port: 16010 + initialDelaySeconds: 10 + timeoutSeconds: 2 + volumeMounts: + - name: hbase-config + mountPath: /tmp/hbase-config + volumes: + - name: hbase-config + configMap: + name: hbase-configmap \ No newline at end of file diff --git a/templates/hbase-master-svc.yaml b/templates/hbase-master-svc.yaml index 6e794062002724e5fc5a58635c3059d2cee78588..d9bb4effad73a90199c4b758cd06bf40a7825225 100644 --- a/templates/hbase-master-svc.yaml +++ b/templates/hbase-master-svc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "hbase.name" . }}-hbase-master + name: {{ template "hbase.fullname" . }}-master labels: app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} diff --git a/templates/hbase-rs-pdb.yaml b/templates/hbase-rs-pdb.yaml index d3ed0e2e163ca5996dfc98c6adb0e15ac5594b74..ed008626267cf900dfc69179ccbca697c2d4ac2e 100644 --- a/templates/hbase-rs-pdb.yaml +++ b/templates/hbase-rs-pdb.yaml @@ -1,9 +1,9 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: - name: {{ template "hbase.name" . }}-hbase-rs + name: {{ template "hbase.name" . }}-rs labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} @@ -11,7 +11,7 @@ metadata: spec: selector: matchLabels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} release: {{ .Release.Name }} component: hbase-rs minAvailable: 1 # FIXME: HA? \ No newline at end of file diff --git a/templates/hbase-rs-statefulset.yaml b/templates/hbase-rs-statefulset.yaml index fc122c53f7b45a2938864fd64f582718b8bc96e3..eb3fd4c544cca7312007ef31bb43da4b81a9d8b1 100644 --- a/templates/hbase-rs-statefulset.yaml +++ b/templates/hbase-rs-statefulset.yaml @@ -1,22 +1,20 @@ apiVersion: apps/v1beta1 kind: StatefulSet metadata: - name: {{ template "hbase.name" . }}-hbase-rs - annotations: - checksum/config: {{ include (print $.Template.BasePath "/hadoop-configmap.yaml") . | sha256sum }} + name: {{ template "hbase.name" . }}-rs labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: hbase-rs spec: - serviceName: {{ template "hbase.name" . }}-hbase-rs - replicas: {{ .Values.hbase.region.replicas }} + serviceName: {{ template "hbase.name" . }}-rs + replicas: {{ .Values.hdfs.dataNode.replicas }} template: metadata: labels: - app: {{ template "hadoop.name" . }} + app: {{ template "hbase.name" . }} release: {{ .Release.Name }} component: hbase-rs spec: @@ -25,46 +23,35 @@ spec: - topologyKey: "kubernetes.io/hostname" labelSelector: matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name | quote }} + app: {{ .Values.hbase.hdfs.name }} + release: {{ .Values.hbase.hdfs.release | quote }} component: hdfs-nn terminationGracePeriodSeconds: 0 containers: - name: hbase-rs - image: "{{ .Values.hbaseimage.repository }}:{{ .Values.hbaseimage.tag }}" - imagePullPolicy: {{ .Values.hbaseimage.pullPolicy }} - env: - - name: HBASE_SERVER_TYPE - value: hbase-regionserver - - name: HDFS_PATH - value: {{ template "hbase.name" . }}-hdfs-nn:9000 - - name: ZOOKEEPER_SERVICE_LIST - value: {{ .Values.hbase.env.zookeeperServiceList }} - - name: ZOOKEEPER_PORT - value: "{{ .Values.hbase.env.zookeeperPort }}" - - name: ZNODE_PARENT - value: hbase - ports: - - name: port11 - containerPort: 16020 - protocol: TCP - - name: port12 - containerPort: 16030 - protocol: TCP + image: {{ .Values.hbaseImage }} + imagePullPolicy: {{ .Values.imagePullPolicy }} command: - - "/bin/bash" - - "/opt/hbase/bin/start-k8s-hbase.sh" + - "/bin/bash" + - "/tmp/hbase-config/bootstrap.sh" resources: -{{ toYaml .Values.hbase.region.resources | indent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} +{{ toYaml .Values.hdfs.nameNode.resources | indent 10 }} + readinessProbe: + httpGet: + path: / + port: 16030 + initialDelaySeconds: 5 + timeoutSeconds: 2 + livenessProbe: + httpGet: + path: / + port: 16030 + initialDelaySeconds: 10 + timeoutSeconds: 2 + volumeMounts: + - name: hbase-config + mountPath: /tmp/hbase-config + volumes: + - name: hbase-config + configMap: + name: hbase-configmap \ No newline at end of file diff --git a/templates/hbase-rs-svc.yaml b/templates/hbase-rs-svc.yaml index 95c541be75e69a7db05a30a01132917e28ab18c3..00f0f190d028fb3358e52af62bb6bf8842fad482 100644 --- a/templates/hbase-rs-svc.yaml +++ b/templates/hbase-rs-svc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "hbase.name" . }}-hbase-rs + name: {{ template "hbase.fullname" . }}-rs labels: app: {{ template "hbase.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} diff --git a/templates/hdfs-dn-pdb.yaml b/templates/hdfs-dn-pdb.yaml deleted file mode 100644 index 93b9a4226fd762e88216eca9001b3168b2b826b6..0000000000000000000000000000000000000000 --- a/templates/hdfs-dn-pdb.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: {{ template "hbase.name" . }}-hdfs-dn - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-dn -spec: - selector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-dn - minAvailable: {{ .Values.hdfs.dataNode.pdbMinAvailable }} \ No newline at end of file diff --git a/templates/hdfs-dn-statefulset.yaml b/templates/hdfs-dn-statefulset.yaml deleted file mode 100644 index 4fc9ac1122fc4b23b520fe02195578eb4b06a325..0000000000000000000000000000000000000000 --- a/templates/hdfs-dn-statefulset.yaml +++ /dev/null @@ -1,99 +0,0 @@ -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: {{ template "hbase.name" . }}-hdfs-dn - annotations: - checksum/config: {{ include (print $.Template.BasePath "/hadoop-configmap.yaml") . | sha256sum }} - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-dn -spec: - serviceName: {{ template "hbase.name" . }}-hdfs-dn - replicas: {{ .Values.hdfs.dataNode.replicas }} - template: - metadata: - labels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-dn - spec: - affinity: - podAntiAffinity: - {{- if eq .Values.antiAffinity "hard" }} - requiredDuringSchedulingIgnoredDuringExecution: - - topologyKey: "kubernetes.io/hostname" - labelSelector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name | quote }} - component: hdfs-dn - {{- else if eq .Values.antiAffinity "soft" }} - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 5 - podAffinityTerm: - topologyKey: "kubernetes.io/hostname" - labelSelector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name | quote }} - component: hdfs-dn - {{- end }} - terminationGracePeriodSeconds: 0 - containers: - - name: hdfs-dn - image: {{ .Values.image }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - command: - - "/bin/bash" - - "/tmp/hadoop-config/bootstrap.sh" - - "-d" - resources: -{{ toYaml .Values.hdfs.dataNode.resources | indent 10 }} - readinessProbe: - httpGet: - path: / - port: 50075 - initialDelaySeconds: 5 - timeoutSeconds: 2 - livenessProbe: - httpGet: - path: / - port: 50075 - initialDelaySeconds: 10 - timeoutSeconds: 2 - volumeMounts: - - name: hadoop-config - mountPath: /tmp/hadoop-config - - name: dfs - mountPath: /root/hdfs/datanode - volumes: - - name: hadoop-config - configMap: - name: hadoop-configmap - {{- if .Values.persistence.dataNode.enabled }} - volumeClaimTemplates: - - metadata: - name: dfs - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-dn - spec: - accessModes: - - {{ .Values.persistence.dataNode.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.dataNode.size | quote }} - {{- if .Values.persistence.dataNode.storageClass }} - {{- if (eq "-" .Values.persistence.dataNode.storageClass) }} - storageClassName: "" - {{- else }} - storageClassName: "{{ .Values.persistence.dataNode.storageClass }}" - {{- end }} - {{- end }} - {{- end }} diff --git a/templates/hdfs-dn-svc.yaml b/templates/hdfs-dn-svc.yaml deleted file mode 100644 index 1b3f218066fbc70342ca580e86ff3c3b51d4746f..0000000000000000000000000000000000000000 --- a/templates/hdfs-dn-svc.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# A headless service to create DNS records -apiVersion: v1 -kind: Service -metadata: - name: {{ template "hbase.name" . }}-hdfs-dn - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-dn -spec: - clusterIP: "None" - ports: - - name: dfs - port: 9000 - protocol: TCP - - name: webhdfs - port: 50075 - selector: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-dn \ No newline at end of file diff --git a/templates/hdfs-nn-pdb.yaml b/templates/hdfs-nn-pdb.yaml deleted file mode 100644 index 2563d4039ec8ae9374b28a054733214dd59dfc65..0000000000000000000000000000000000000000 --- a/templates/hdfs-nn-pdb.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: {{ template "hbase.name" . }}-hdfs-nn - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-nn -spec: - selector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-nn - minAvailable: {{ .Values.hdfs.nameNode.pdbMinAvailable }} - \ No newline at end of file diff --git a/templates/hdfs-nn-statefulset.yaml b/templates/hdfs-nn-statefulset.yaml deleted file mode 100644 index 4e2d09c6b9a572b73a6025d28ee900e64bb082c9..0000000000000000000000000000000000000000 --- a/templates/hdfs-nn-statefulset.yaml +++ /dev/null @@ -1,99 +0,0 @@ -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: {{ template "hbase.name" . }}-hdfs-nn - annotations: - checksum/config: {{ include (print $.Template.BasePath "/hadoop-configmap.yaml") . | sha256sum }} - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-nn -spec: - serviceName: {{ template "hbase.name" . }}-hdfs-nn - replicas: 1 - template: - metadata: - labels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-nn - spec: - affinity: - podAntiAffinity: - {{- if eq .Values.antiAffinity "hard" }} - requiredDuringSchedulingIgnoredDuringExecution: - - topologyKey: "kubernetes.io/hostname" - labelSelector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name | quote }} - component: hdfs-nn - {{- else if eq .Values.antiAffinity "soft" }} - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 5 - podAffinityTerm: - topologyKey: "kubernetes.io/hostname" - labelSelector: - matchLabels: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name | quote }} - component: hdfs-nn - {{- end }} - terminationGracePeriodSeconds: 0 - containers: - - name: hdfs-nn - image: {{ .Values.image }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - command: - - "/bin/bash" - - "/tmp/hadoop-config/bootstrap.sh" - - "-d" - resources: -{{ toYaml .Values.hdfs.nameNode.resources | indent 10 }} - readinessProbe: - httpGet: - path: / - port: 50070 - initialDelaySeconds: 5 - timeoutSeconds: 2 - livenessProbe: - httpGet: - path: / - port: 50070 - initialDelaySeconds: 10 - timeoutSeconds: 2 - volumeMounts: - - name: hadoop-config - mountPath: /tmp/hadoop-config - - name: dfs - mountPath: /root/hdfs/namenode - volumes: - - name: hadoop-config - configMap: - name: hadoop-configmap - {{- if .Values.persistence.nameNode.enabled }} - volumeClaimTemplates: - - metadata: - name: dfs - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-nn - spec: - accessModes: - - {{ .Values.persistence.nameNode.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.nameNode.size | quote }} - {{- if .Values.persistence.nameNode.storageClass }} - {{- if (eq "-" .Values.persistence.nameNode.storageClass) }} - storageClassName: "" - {{- else }} - storageClassName: "{{ .Values.persistence.nameNode.storageClass }}" - {{- end }} - {{- end }} - {{- end }} diff --git a/templates/hdfs-nn-svc.yaml b/templates/hdfs-nn-svc.yaml deleted file mode 100644 index 1f5f100be259f6f9478ce5e9c474aa3bf13f6fc5..0000000000000000000000000000000000000000 --- a/templates/hdfs-nn-svc.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# A headless service to create DNS records -apiVersion: v1 -kind: Service -metadata: - name: {{ template "hbase.name" . }}-hdfs-nn - labels: - app: {{ template "hadoop.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: hdfs-nn -spec: - clusterIP: "None" - ports: - - name: dfs - port: 9000 - protocol: TCP - - name: webhdfs - port: 50070 - selector: - app: {{ template "hadoop.name" . }} - release: {{ .Release.Name }} - component: hdfs-nn \ No newline at end of file diff --git a/values-overrides.yaml b/values-overrides.yaml index ddfe7492d2b428581e60f0e9a460dfc91e3f0b75..b0a7ec6394feabf44a3c7a3ed93e37a25fd2bcfd 100644 --- a/values-overrides.yaml +++ b/values-overrides.yaml @@ -1,16 +1,7 @@ # The base hadoop image to use for all components. -# See this repo for image build details: https://github.com/Comcast/kube-yarn/tree/master/image -image: registry.cn-qingdao.aliyuncs.com/wod/hadoop:2.7.3 -imagePullPolicy: IfNotPresent +# See this repo for image build details: https://github.com/chenseanxy/helm-hbase-chart/tree/master/image -hbaseimage: - repository: registry.cn-qingdao.aliyuncs.com/wod/hbase - tag: latest - pullPolicy: Always -hbaseVersion: 1.4.9 - -# The version of the hadoop libraries being used in the image. -hadoopVersion: 2.7.3 +hbaseImage: registry.cn-qingdao.aliyuncs.com/wod/hbase:2.1.7 # Select anitAffinity as either hard or soft, default is hard antiAffinity: "soft" @@ -21,11 +12,11 @@ hdfs: resources: requests: - memory: "2048Mi" + memory: "256Mi" cpu: "10m" limits: - memory: "2048Mi" - cpu: "1000m" + memory: "8Gi" + cpu: "4000m" dataNode: replicas: 3 @@ -34,46 +25,30 @@ hdfs: resources: requests: - memory: "2048Mi" + memory: "256Mi" cpu: "10m" limits: - memory: "2048Mi" - cpu: "1000m" + memory: "8Gi" + cpu: "4000m" persistence: nameNode: - enabled: true - storageClass: "rook-ceph-block" + enabled: false + storageClass: "-" accessMode: ReadWriteOnce size: 50Gi dataNode: - enabled: true - storageClass: "rook-ceph-block" + enabled: false + storageClass: "-" accessMode: ReadWriteOnce - size: 20Gi + size: 200Gi hbase: - env: - zookeeperServiceList: myzk-zookeeper - zookeeperPort: "2181" - master: + hmaster: replicas: 1 - resources: - requests: - memory: "2048Mi" - cpu: "10m" - limits: - memory: "2048Mi" - cpu: "1000m" - region: - replicas: 3 - resources: - requests: - memory: "2048Mi" - cpu: "10m" - limits: - memory: "2048Mi" - cpu: "1000m" + hdfs: + name: "hadoop-hadoop" + release: "hadoop" zookeeper: - quorum: "myzk-zookeeper" + quorum: "myzk-zookeeper-headless" diff --git a/values.yaml b/values.yaml index d41091ac5fa8ea85985f04805256667d6d966688..90ea7666810bc38cff27e1c1f29033dfc0ddb524 100644 --- a/values.yaml +++ b/values.yaml @@ -1,16 +1,7 @@ # The base hadoop image to use for all components. -# See this repo for image build details: https://github.com/Comcast/kube-yarn/tree/master/image -image: danisla/hadoop:2.7.3 -imagePullPolicy: IfNotPresent +# See this repo for image build details: https://github.com/chenseanxy/helm-hbase-chart/tree/master/image -hbaseimage: - repository: 33098876/hbase - tag: lastest - pullPolicy: Always -hbaseVersion: 1.4.9 - -# The version of the hadoop libraries being used in the image. -hadoopVersion: 2.7.3 +hbaseImage: chenseanxy/hbase:1.4.10-hadoop3.1.2 # Select anitAffinity as either hard or soft, default is hard antiAffinity: "soft" @@ -21,7 +12,7 @@ hdfs: resources: requests: - memory: "2048Mi" + memory: "256Mi" cpu: "10m" limits: memory: "2048Mi" @@ -34,7 +25,7 @@ hdfs: resources: requests: - memory: "2048Mi" + memory: "256Mi" cpu: "10m" limits: memory: "2048Mi" @@ -54,26 +45,10 @@ persistence: size: 200Gi hbase: - env: - zookeeperServiceList: myzk-zookeeper - zookeeperPort: "2181" - master: + hmaster: replicas: 1 - resources: - requests: - memory: "2048Mi" - cpu: "10m" - limits: - memory: "2048Mi" - cpu: "1000m" - region: - replicas: 3 - resources: - requests: - memory: "2048Mi" - cpu: "10m" - limits: - memory: "2048Mi" - cpu: "1000m" + hdfs: + name: "hadoop" + release: "hadoop" zookeeper: - quorum: "myzk-zookeeper" + quorum: "zookeeper" \ No newline at end of file