This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch document
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/document by this push:
     new 5aab70f  KYLIN-4448 Kylin on Kubernetes Doc
5aab70f is described below

commit 5aab70f15f24c678db4d5a483fdf2a5219ac07db
Author: XiaoxiangYu <hit_la...@126.com>
AuthorDate: Tue Apr 28 11:33:19 2020 +0800

    KYLIN-4448 Kylin on Kubernetes Doc
---
 website/_data/docs-cn.yml                      |   1 +
 website/_data/docs.yml                         |   3 +-
 website/_data/docs31-cn.yml                    |   1 +
 website/_data/docs31.yml                       |   3 +-
 website/_docs/install/Kylin_kubernetes.cn.md   | 190 +++++++++++++++++++++++
 website/_docs/install/Kylin_kubernetes.md      | 204 +++++++++++++++++++++++++
 website/_docs31/install/Kylin_kubernetes.cn.md | 190 +++++++++++++++++++++++
 website/_docs31/install/Kylin_kubernetes.md    | 204 +++++++++++++++++++++++++
 8 files changed, 794 insertions(+), 2 deletions(-)

diff --git a/website/_data/docs-cn.yml b/website/_data/docs-cn.yml
index ca5aa17..c8c31fe 100644
--- a/website/_data/docs-cn.yml
+++ b/website/_data/docs-cn.yml
@@ -25,6 +25,7 @@
   - install/configuration
   - install/kylin_aws_emr
   - install/kylin_docker
+  - install/kylin_on_kubernetes
 
 - title: 教程
   docs:
diff --git a/website/_data/docs.yml b/website/_data/docs.yml
index 69c642f..aaccf40 100644
--- a/website/_data/docs.yml
+++ b/website/_data/docs.yml
@@ -33,7 +33,8 @@
   - install/configuration
   - install/kylin_aws_emr
   - install/kylin_docker
-  
+  - install/kylin_on_kubernetes
+
 - title: Tutorial
   docs:
   - tutorial/kylin_sample
diff --git a/website/_data/docs31-cn.yml b/website/_data/docs31-cn.yml
index 6d7b085..35bf9ac 100644
--- a/website/_data/docs31-cn.yml
+++ b/website/_data/docs31-cn.yml
@@ -24,6 +24,7 @@
   - install/configuration
   - install/kylin_aws_emr
   - install/kylin_docker
+  - install/kylin_on_kubernetes
 
 - title: 教程
   docs:
diff --git a/website/_data/docs31.yml b/website/_data/docs31.yml
index 4f9e47b..6a1af45 100644
--- a/website/_data/docs31.yml
+++ b/website/_data/docs31.yml
@@ -32,7 +32,8 @@
   - install/configuration
   - install/kylin_aws_emr
   - install/kylin_docker
-  
+  - install/kylin_on_kubernetes
+
 - title: Tutorial
   docs:
   - tutorial/kylin_sample
diff --git a/website/_docs/install/Kylin_kubernetes.cn.md 
b/website/_docs/install/Kylin_kubernetes.cn.md
new file mode 100644
index 0000000..d810525
--- /dev/null
+++ b/website/_docs/install/Kylin_kubernetes.cn.md
@@ -0,0 +1,190 @@
+---
+layout: docs
+title:  "在 Kubernetes 上部署 Kylin"
+categories: install
+permalink: /cn/docs/install/kylin_on_kubernetes.html
+since: v3.0.2
+---
+
+Kubernetes是一个易于移植,易于扩展的,用于管理容器化的 workload 和 service 
的开源平台,通过声明式的配置和自动化,使得集群运维负担大大减少。
+
+Apache Kylin 是一个开源的的分布式的,针对大数据场景下的高性能分析型数据仓库。在 Kubernetes 集群上部署 Kylin,可以减少 
Kylin 集群维护和扩容的代价。
+
+## 目录
+下载获取 https://github.com/apache/kylin/tree/master/kubernetes, 得到以下文件:
+
+- **config** 
+ 这里是存放 Hadoop 和 Kylin 配置文件的地方。
+- **template** 
+ 这个目录提供了两个部署模板: 
+    - Quick-start 模板为了单节点(Poc)目的准备的;只部署了一个 **all** 节点。
+    - Production 模板是为多节点部署准备的;此外还集成了 Memcached 服务以满足分布式查询缓存需求,以及 filebeat([ELK 
stack](https://www.elastic.co/what-is/elk-stack)) 以满足日志收集和分析需求。
+- **docker** 
+ Docker 镜像是在 Kubernetes 上部署 Kylin 的前置条件,请参考此路径的说明,来构建所需镜像。CDH5.x 用户可以直接从 
Dockerhub 获取预先构建好的镜像。
+ 
+## 前置条件
+ 
+1. 一个 Hadoop 集群
+2. 一个 Kubernetes 集群
+3. **kylin-client** 镜像
+4. 一个 Elasticsearch 集群(可选的)
+
+## 如何构建所需 docker 镜像
+
+#### hadoop-client 镜像
+
+我们都知道,部署 Kylin 的节点需要包含 Hadoop 依赖,以便 Kylin 通过客户端访问 Hadoop 集群的各个组件。不幸地,每一个 
Hadoop 分发版本各自不同。所以我们可以为所需的 Hadoop 分发版本构建 Docker 镜像,会有以下好处:
+- 可以让对特定 Hadoop 环境更加熟悉的人负责准备该镜像,让 Kylin 用户更加方便地基于 Hadoop-Client 镜像构建 Kylin 镜像。
+- Kylin 的升级会更加方便。
+
+构建步骤
+- 准备或者修改 Dockerfile。 
+- 获取 Spark 二进制包(例如 `spark-2.3.2-bin-hadoop2.7.tgz`) 到 路径`provided-binary`。
+- 运行 `build-image.sh` 来构建镜像。
+
+#### Kylin-client 镜像
+
+**kylin-client** 是一个基于 **hadoop-client** 的镜像, 两者分离使得 Kylin 升级更加简单。
+
+构建步骤
+- 获取 Kylin 二进制包(例如 `apache-kylin-3.0.1-bin-cdh57.tar.gz`) 在当前目录解压。
+- 修改 `Dockerfile` , 将 `KYLIN_VERSION` 和 base image(hadoop-client) 改为合适的值。
+- 运行 `build-image.sh` 来构建镜像。
+
+## 如何在 Kubernetes 部署 Kylin
+
+在这里,我们以如何基于 CDH5.x 环境部署 Kylin 集群。
+
+1 进入到 `kubenetes/template/production/example/deployment` 路径
+
+2 替换 Hadoop 配置文件到 (`kubenetes/template/production/example/config/hadoop`) 并且修改 
filebeat 配置文件。
+
+3 部署 Memcached 服务
+- Apply kubernetes objects.
+```
+$ kubectl apply -f memcached/
+service/cache-svc created
+statefulset.apps/kylin-memcached created
+```
+- 获取 Memcached 服务地址
+``` 
+$ kubectl run -it--image=busybox:1.28.4--rm--restart=Never sh -n test-dns
+If you don't see a command prompt, try pressing enter.
+/ # nslookup cache-svc.kylin-example.svc.cluster.local
+Server: 10.96.0.10
+Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
+Name:   cache-svc.kylin-example.svc.cluster.local
+Address 1: 192.168.11.44 
kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local
+/ #
+```
+
+4 部署 Kylin 服务
+- 修改 Memcached 配置
+``` 
+## modify memcached hostname(session sharing)
+## 
memcachedNodes="n1:kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211"
+$ vim ../config/tomcat/context.xml
+modify memcached hostname(query cache)
+## 
kylin.cache.memcached.hosts=kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211
+$ vim ../config/kylin-job/kylin.properties
+$ vim ../config/kylin-query/kylin.properties
+```
+- 创建 ConfigMap
+``` 
+$ kubectl create configmap -n kylin-example hadoop-config \
+--from-file=../config/hadoop/core-site.xml \
+--from-file=../config/hadoop/hdfs-site.xml \
+--from-file=../config/hadoop/yarn-site.xml \
+--from-file=../config/hadoop/mapred-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hive-config \
+--from-file=../config/hadoop/hive-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hbase-config \
+--from-file=../config/hadoop/hbase-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-more-config \
+--from-file=../config/kylin-more/applicationContext.xml \
+--from-file=../config/kylin-more/ehcache.xml \
+--from-file=../config/kylin-more/ehcache-test.xml \
+--from-file=../config/kylin-more/kylinMetrics.xml \
+--from-file=../config/kylin-more/kylinSecurity.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-job-config  \
+--from-file=../config/kylin-job/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-job/kylin_hive_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-job/kylin-server-log4j.properties \
+--from-file=../config/kylin-job/kylin-spark-log4j.properties \
+--from-file=../config/kylin-job/kylin-tools-log4j.properties \
+--from-file=../config/kylin-job/kylin.properties \
+--from-file=../config/kylin-job/setenv.sh \
+--from-file=../config/kylin-job/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-query-config  \
+--from-file=../config/kylin-query/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-query/kylin_hive_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-query/kylin-server-log4j.properties \
+--from-file=../config/kylin-query/kylin-spark-log4j.properties \
+--from-file=../config/kylin-query/kylin-tools-log4j.properties \
+--from-file=../config/kylin-query/kylin.properties \
+--from-file=../config/kylin-query/setenv.sh \
+--from-file=../config/kylin-query/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example filebeat-config  \
+--from-file=../config/filebeat/filebeat.yml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example tomcat-config  \
+--from-file=../config/tomcat/server.xml \
+--from-file=../config/tomcat/context.xml \
+--dry-run -o yaml | kubectl apply -f -
+```
+- 部署 Kylin 的 Job server
+```
+$ kubectl apply -f kylin-job/
+service/kylin-job-svc created
+statefulset.apps/kylin-job created
+```
+- 部署 Kylin 的 Query server
+``` 
+$ kubectl apply -f kylin-query/
+service/kylin-query-svc created
+statefulset.apps/kylin-query created
+```
+
+5 访问 Web UI
+  - http://${HOSTNAME}:30012/kylin 对应 QueryServer
+
+6 停止 Kylin 服务
+``` 
+$ kubectl delete -f memcached/
+$ kubectl delete -f kylin-query/
+$ kubectl delete -f kylin-job/
+```
+
+## 问题诊断
+- 获取指定 Pod 的日志
+```
+##  Output of : sh kylin.sh start
+$ kubectl logs kylin-job-0 kylin -n kylin-example
+$ kubectl logs -f kylin-job-0 kylin -n kylin-example
+```
+ 
+- 访问指定 Pod
+``` 
+$ kubectl exec -it  {POD_NAME} -n kylin-example-- bash
+```   
+
+- 检查指定 Pod 启动失败原因
+``` 
+$ kubectl get pod {POD_NAME} -n kylin-example -o yaml
+```
+
+- 如果你没有 Elasticsearch 集群,或者有替代的日志收集方案, 请从 `kylin-query-stateful.yaml` 和 
`kylin-job-stateful.yaml` 移除 **filebeat** 容器。
+
+- JIRA issue: [KYLIN-4447 Kylin on kubernetes in production 
env](https://issues.apache.org/jira/browse/KYLIN-4447) 。
+
+- 尝试在 DockerHub 上寻找预先构建好的 kylin-client image: 
[apachekylin/kylin-client](https://hub.docker.com/r/apachekylin/kylin-client). 
\ No newline at end of file
diff --git a/website/_docs/install/Kylin_kubernetes.md 
b/website/_docs/install/Kylin_kubernetes.md
new file mode 100644
index 0000000..8f70a8a
--- /dev/null
+++ b/website/_docs/install/Kylin_kubernetes.md
@@ -0,0 +1,204 @@
+---
+layout: docs
+title:  "Deploy Kylin on Kubernetes"
+categories: install
+permalink: /docs/install/kylin_on_kubernetes.html
+since: v3.0.2
+---
+
+Kubernetes is a portable, extensible, open-source platform for managing 
containerized workloads and services, that facilitates both declarative 
configuration and automation. It has a large, rapidly growing ecosystem. 
Kubernetes services, support, and tools are widely available.
+
+Apache Kylin is a open source, distributed analytical data warehouse for big 
data. Deploy Kylin on Kubernetes cluster, will reduce cost of maintenance and 
extension.
+
+## Directory
+Visit and download https://github.com/apache/kylin/tree/master/kubernetes and 
you will find three directory:
+
+- **config** 
+ Please update your configuration file here.
+- **template** 
+ This directory provided two deployment templates, one for quick-start 
purpose, another for production/distributed deployment.
+    - Quick-start template is for one node deployment with an ALL kylin 
instance.
+    - Production template is for multi-nodes deployment with a few of 
job/query kylin instances; and some other service like memcached and 
filebeat(check doc at [ELK stack](https://www.elastic.co/what-is/elk-stack)) 
will help to satisfy log collection/query cache/session sharing demand.
+- **docker** 
+ Docker image is the pre-requirement of Kylin on Kubernetes, please check this 
directory if you need build it yourself. For CDH5.x user, you may consider use 
a provided image on DockerHub.
+ 
+---
+ 
+## Pre-requirements
+ 
+1. A hadoop cluster.
+2. A K8s cluster, with sufficient system resources.
+3. **kylin-client** image.
+4. A Elasticsearch cluster(maybe optional).
+
+## How to build docker image
+
+### Hadoop-client image
+
+What is hadoop-client docker image and why we need this?
+
+As we all know, the node you want to deploy Kylin, should contains Hadoop 
dependency(jars and configuration files), these dependency let you have access 
to Hadoop Service, such as HDFS, HBase, Hive, which are needed by Apache Kylin. 
Unfortunately, each Hadoop distribution(CHD or HDP etc.) has its own specific 
jars. So, we can build specific image for specific Hadoop distribution, which 
will make image management task more easier. This will have following two 
benefits:
+
+- Someone who has better knowledge on Hadoop can do this work, and let kylin 
user build their Kylin image base on provided Hadoop-Client image.
+- Upgrade Kylin will be much easier.
+
+Build Step
+- Prepare and modify Dockerfile(If you are using other hadoop distribution, 
please consider build image yourself). 
+- Place Spark binary(such as `spark-2.3.2-bin-hadoop2.7.tgz`) into dir 
`provided-binary`.
+- Run `build-image.sh` to build image.
+
+### Kylin-client image
+ 
+What is kylin-client docker images? 
+
+**kylin-client** is a docker image which based on **hadoop-client**, it will 
provided the flexibility of upgrade of Apache Kylin.
+
+Build Step
+
+- Place Kylin binary(such as `apache-kylin-3.0.1-bin-cdh57.tar.gz`) and 
uncompress it into current dir.
+- Modify `Dockerfile` , change the value of `KYLIN_VERSION` and name of base 
image(hadoop-client).
+- Run `build-image.sh` to build image.
+
+----
+
+## How to deploy kylin on kubernetes
+
+Here let's take a look of how to deploy a kylin cluster which connect to CDH 
5.7.
+
+1 `kubenetes/template/production/example/deployment` is the working directory.
+
+2 Update hadoop configuration files 
(`kubenetes/template/production/example/config/hadoop`) and filebeat 's 
configuration file.
+
+3 Create statefulset and service for memcached.
+
+- Apply kubernetes objects.
+```
+$ kubectl apply -f memcached/
+service/cache-svc created
+statefulset.apps/kylin-memcached created
+```
+- Check hostname of cache service.
+``` 
+$ kubectl run -it--image=busybox:1.28.4--rm--restart=Never sh -n test-dns
+If you don't see a command prompt, try pressing enter.
+/ # nslookup cache-svc.kylin-example.svc.cluster.local
+Server: 10.96.0.10
+Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
+Name:   cache-svc.kylin-example.svc.cluster.local
+Address 1: 192.168.11.44 
kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local
+/ #
+```
+
+4 Create statefulset and service for Apache Kylin.
+- Modify memcached configuration.
+``` 
+// modify memcached hostname(session sharing)
+// 
memcachedNodes="n1:kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211"
+$ vim ../config/tomcat/context.xml
+// modify memcached hostname(query cache)
+// 
kylin.cache.memcached.hosts=kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211
+$ vim ../config/kylin-job/kylin.properties
+$ vim ../config/kylin-query/kylin.properties
+```
+- Create configMap
+``` 
+$ kubectl create configmap -n kylin-example hadoop-config \
+--from-file=../config/hadoop/core-site.xml \
+--from-file=../config/hadoop/hdfs-site.xml \
+--from-file=../config/hadoop/yarn-site.xml \
+--from-file=../config/hadoop/mapred-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hive-config \
+--from-file=../config/hadoop/hive-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hbase-config \
+--from-file=../config/hadoop/hbase-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-more-config \
+--from-file=../config/kylin-more/applicationContext.xml \
+--from-file=../config/kylin-more/ehcache.xml \
+--from-file=../config/kylin-more/ehcache-test.xml \
+--from-file=../config/kylin-more/kylinMetrics.xml \
+--from-file=../config/kylin-more/kylinSecurity.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-job-config  \
+--from-file=../config/kylin-job/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-job/kylin_hive_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-job/kylin-server-log4j.properties \
+--from-file=../config/kylin-job/kylin-spark-log4j.properties \
+--from-file=../config/kylin-job/kylin-tools-log4j.properties \
+--from-file=../config/kylin-job/kylin.properties \
+--from-file=../config/kylin-job/setenv.sh \
+--from-file=../config/kylin-job/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-query-config  \
+--from-file=../config/kylin-query/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-query/kylin_hive_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-query/kylin-server-log4j.properties \
+--from-file=../config/kylin-query/kylin-spark-log4j.properties \
+--from-file=../config/kylin-query/kylin-tools-log4j.properties \
+--from-file=../config/kylin-query/kylin.properties \
+--from-file=../config/kylin-query/setenv.sh \
+--from-file=../config/kylin-query/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example filebeat-config  \
+--from-file=../config/filebeat/filebeat.yml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example tomcat-config  \
+--from-file=../config/tomcat/server.xml \
+--from-file=../config/tomcat/context.xml \
+--dry-run -o yaml | kubectl apply -f -
+```
+- Deploy Kylin's Job server
+```
+$ kubectl apply -f kylin-job/
+service/kylin-job-svc created
+statefulset.apps/kylin-job created
+```
+- Deploy Kylin's Query server
+``` 
+$ kubectl apply -f kylin-query/
+service/kylin-query-svc created
+statefulset.apps/kylin-query created
+```
+
+5 Kylin Service
+
+- Visit Web UI
+  - http://${HOSTNAME}:30012/kylin for Query Server
+
+6 Clean up
+
+``` 
+$ kubectl delete -f memcached/
+$ kubectl delete -f kylin-query/
+$ kubectl delete -f kylin-job/
+```
+
+## Troubleshooting
+- Check logs of specific pod
+```
+//  Output of : sh kylin.sh start
+$ kubectl logs kylin-job-0 kylin -n kylin-example
+$ kubectl logs -f kylin-job-0 kylin -n kylin-example
+```
+ 
+- Attach to a specific pod, say "kylin-job-0".   
+``` 
+$ kubectl exec -it  kylin-job-0  -n kylin-example-- bash
+```   
+
+- Check failure reasons of specific pod
+``` 
+$ kubectl get pod kylin-job-0  -n kylin-example -o yaml
+```
+
+- If you don't have a Elasticsearch cluster or not interested in log 
collection, please remove filebeat container in both kylin-query-stateful.yaml 
and kylin-job-stateful.yaml.
+
+- If you want to check detail or want to have a discussion, please read or 
comment on [KYLIN-4447 Kylin on kubernetes in production 
env](https://issues.apache.org/jira/browse/KYLIN-4447) .
+
+- Find provided docker image at: DockerHub: : 
[apachekylin/kylin-client](https://hub.docker.com/r/apachekylin/kylin-client)
\ No newline at end of file
diff --git a/website/_docs31/install/Kylin_kubernetes.cn.md 
b/website/_docs31/install/Kylin_kubernetes.cn.md
new file mode 100644
index 0000000..d810525
--- /dev/null
+++ b/website/_docs31/install/Kylin_kubernetes.cn.md
@@ -0,0 +1,190 @@
+---
+layout: docs
+title:  "在 Kubernetes 上部署 Kylin"
+categories: install
+permalink: /cn/docs/install/kylin_on_kubernetes.html
+since: v3.0.2
+---
+
+Kubernetes是一个易于移植,易于扩展的,用于管理容器化的 workload 和 service 
的开源平台,通过声明式的配置和自动化,使得集群运维负担大大减少。
+
+Apache Kylin 是一个开源的的分布式的,针对大数据场景下的高性能分析型数据仓库。在 Kubernetes 集群上部署 Kylin,可以减少 
Kylin 集群维护和扩容的代价。
+
+## 目录
+下载获取 https://github.com/apache/kylin/tree/master/kubernetes, 得到以下文件:
+
+- **config** 
+ 这里是存放 Hadoop 和 Kylin 配置文件的地方。
+- **template** 
+ 这个目录提供了两个部署模板: 
+    - Quick-start 模板为了单节点(Poc)目的准备的;只部署了一个 **all** 节点。
+    - Production 模板是为多节点部署准备的;此外还集成了 Memcached 服务以满足分布式查询缓存需求,以及 filebeat([ELK 
stack](https://www.elastic.co/what-is/elk-stack)) 以满足日志收集和分析需求。
+- **docker** 
+ Docker 镜像是在 Kubernetes 上部署 Kylin 的前置条件,请参考此路径的说明,来构建所需镜像。CDH5.x 用户可以直接从 
Dockerhub 获取预先构建好的镜像。
+ 
+## 前置条件
+ 
+1. 一个 Hadoop 集群
+2. 一个 Kubernetes 集群
+3. **kylin-client** 镜像
+4. 一个 Elasticsearch 集群(可选的)
+
+## 如何构建所需 docker 镜像
+
+#### hadoop-client 镜像
+
+我们都知道,部署 Kylin 的节点需要包含 Hadoop 依赖,以便 Kylin 通过客户端访问 Hadoop 集群的各个组件。不幸地,每一个 
Hadoop 分发版本各自不同。所以我们可以为所需的 Hadoop 分发版本构建 Docker 镜像,会有以下好处:
+- 可以让对特定 Hadoop 环境更加熟悉的人负责准备该镜像,让 Kylin 用户更加方便地基于 Hadoop-Client 镜像构建 Kylin 镜像。
+- Kylin 的升级会更加方便。
+
+构建步骤
+- 准备或者修改 Dockerfile。 
+- 获取 Spark 二进制包(例如 `spark-2.3.2-bin-hadoop2.7.tgz`) 到 路径`provided-binary`。
+- 运行 `build-image.sh` 来构建镜像。
+
+#### Kylin-client 镜像
+
+**kylin-client** 是一个基于 **hadoop-client** 的镜像, 两者分离使得 Kylin 升级更加简单。
+
+构建步骤
+- 获取 Kylin 二进制包(例如 `apache-kylin-3.0.1-bin-cdh57.tar.gz`) 在当前目录解压。
+- 修改 `Dockerfile` , 将 `KYLIN_VERSION` 和 base image(hadoop-client) 改为合适的值。
+- 运行 `build-image.sh` 来构建镜像。
+
+## 如何在 Kubernetes 部署 Kylin
+
+在这里,我们以如何基于 CDH5.x 环境部署 Kylin 集群。
+
+1 进入到 `kubenetes/template/production/example/deployment` 路径
+
+2 替换 Hadoop 配置文件到 (`kubenetes/template/production/example/config/hadoop`) 并且修改 
filebeat 配置文件。
+
+3 部署 Memcached 服务
+- Apply kubernetes objects.
+```
+$ kubectl apply -f memcached/
+service/cache-svc created
+statefulset.apps/kylin-memcached created
+```
+- 获取 Memcached 服务地址
+``` 
+$ kubectl run -it--image=busybox:1.28.4--rm--restart=Never sh -n test-dns
+If you don't see a command prompt, try pressing enter.
+/ # nslookup cache-svc.kylin-example.svc.cluster.local
+Server: 10.96.0.10
+Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
+Name:   cache-svc.kylin-example.svc.cluster.local
+Address 1: 192.168.11.44 
kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local
+/ #
+```
+
+4 部署 Kylin 服务
+- 修改 Memcached 配置
+``` 
+## modify memcached hostname(session sharing)
+## 
memcachedNodes="n1:kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211"
+$ vim ../config/tomcat/context.xml
+modify memcached hostname(query cache)
+## 
kylin.cache.memcached.hosts=kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211
+$ vim ../config/kylin-job/kylin.properties
+$ vim ../config/kylin-query/kylin.properties
+```
+- 创建 ConfigMap
+``` 
+$ kubectl create configmap -n kylin-example hadoop-config \
+--from-file=../config/hadoop/core-site.xml \
+--from-file=../config/hadoop/hdfs-site.xml \
+--from-file=../config/hadoop/yarn-site.xml \
+--from-file=../config/hadoop/mapred-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hive-config \
+--from-file=../config/hadoop/hive-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hbase-config \
+--from-file=../config/hadoop/hbase-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-more-config \
+--from-file=../config/kylin-more/applicationContext.xml \
+--from-file=../config/kylin-more/ehcache.xml \
+--from-file=../config/kylin-more/ehcache-test.xml \
+--from-file=../config/kylin-more/kylinMetrics.xml \
+--from-file=../config/kylin-more/kylinSecurity.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-job-config  \
+--from-file=../config/kylin-job/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-job/kylin_hive_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-job/kylin-server-log4j.properties \
+--from-file=../config/kylin-job/kylin-spark-log4j.properties \
+--from-file=../config/kylin-job/kylin-tools-log4j.properties \
+--from-file=../config/kylin-job/kylin.properties \
+--from-file=../config/kylin-job/setenv.sh \
+--from-file=../config/kylin-job/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-query-config  \
+--from-file=../config/kylin-query/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-query/kylin_hive_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-query/kylin-server-log4j.properties \
+--from-file=../config/kylin-query/kylin-spark-log4j.properties \
+--from-file=../config/kylin-query/kylin-tools-log4j.properties \
+--from-file=../config/kylin-query/kylin.properties \
+--from-file=../config/kylin-query/setenv.sh \
+--from-file=../config/kylin-query/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example filebeat-config  \
+--from-file=../config/filebeat/filebeat.yml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example tomcat-config  \
+--from-file=../config/tomcat/server.xml \
+--from-file=../config/tomcat/context.xml \
+--dry-run -o yaml | kubectl apply -f -
+```
+- 部署 Kylin 的 Job server
+```
+$ kubectl apply -f kylin-job/
+service/kylin-job-svc created
+statefulset.apps/kylin-job created
+```
+- 部署 Kylin 的 Query server
+``` 
+$ kubectl apply -f kylin-query/
+service/kylin-query-svc created
+statefulset.apps/kylin-query created
+```
+
+5 访问 Web UI
+  - http://${HOSTNAME}:30012/kylin 对应 QueryServer
+
+6 停止 Kylin 服务
+``` 
+$ kubectl delete -f memcached/
+$ kubectl delete -f kylin-query/
+$ kubectl delete -f kylin-job/
+```
+
+## 问题诊断
+- 获取指定 Pod 的日志
+```
+##  Output of : sh kylin.sh start
+$ kubectl logs kylin-job-0 kylin -n kylin-example
+$ kubectl logs -f kylin-job-0 kylin -n kylin-example
+```
+ 
+- 访问指定 Pod
+``` 
+$ kubectl exec -it  {POD_NAME} -n kylin-example-- bash
+```   
+
+- 检查指定 Pod 启动失败原因
+``` 
+$ kubectl get pod {POD_NAME} -n kylin-example -o yaml
+```
+
+- 如果你没有 Elasticsearch 集群,或者有替代的日志收集方案, 请从 `kylin-query-stateful.yaml` 和 
`kylin-job-stateful.yaml` 移除 **filebeat** 容器。
+
+- JIRA issue: [KYLIN-4447 Kylin on kubernetes in production 
env](https://issues.apache.org/jira/browse/KYLIN-4447) 。
+
+- 尝试在 DockerHub 上寻找预先构建好的 kylin-client image: 
[apachekylin/kylin-client](https://hub.docker.com/r/apachekylin/kylin-client). 
\ No newline at end of file
diff --git a/website/_docs31/install/Kylin_kubernetes.md 
b/website/_docs31/install/Kylin_kubernetes.md
new file mode 100644
index 0000000..8f70a8a
--- /dev/null
+++ b/website/_docs31/install/Kylin_kubernetes.md
@@ -0,0 +1,204 @@
+---
+layout: docs
+title:  "Deploy Kylin on Kubernetes"
+categories: install
+permalink: /docs/install/kylin_on_kubernetes.html
+since: v3.0.2
+---
+
+Kubernetes is a portable, extensible, open-source platform for managing 
containerized workloads and services, that facilitates both declarative 
configuration and automation. It has a large, rapidly growing ecosystem. 
Kubernetes services, support, and tools are widely available.
+
+Apache Kylin is a open source, distributed analytical data warehouse for big 
data. Deploy Kylin on Kubernetes cluster, will reduce cost of maintenance and 
extension.
+
+## Directory
+Visit and download https://github.com/apache/kylin/tree/master/kubernetes and 
you will find three directory:
+
+- **config** 
+ Please update your configuration file here.
+- **template** 
+ This directory provided two deployment templates, one for quick-start 
purpose, another for production/distributed deployment.
+    - Quick-start template is for one node deployment with an ALL kylin 
instance.
+    - Production template is for multi-nodes deployment with a few of 
job/query kylin instances; and some other service like memcached and 
filebeat(check doc at [ELK stack](https://www.elastic.co/what-is/elk-stack)) 
will help to satisfy log collection/query cache/session sharing demand.
+- **docker** 
+ Docker image is the pre-requirement of Kylin on Kubernetes, please check this 
directory if you need build it yourself. For CDH5.x user, you may consider use 
a provided image on DockerHub.
+ 
+---
+ 
+## Pre-requirements
+ 
+1. A hadoop cluster.
+2. A K8s cluster, with sufficient system resources.
+3. **kylin-client** image.
+4. A Elasticsearch cluster(maybe optional).
+
+## How to build docker image
+
+### Hadoop-client image
+
+What is hadoop-client docker image and why we need this?
+
+As we all know, the node you want to deploy Kylin, should contains Hadoop 
dependency(jars and configuration files), these dependency let you have access 
to Hadoop Service, such as HDFS, HBase, Hive, which are needed by Apache Kylin. 
Unfortunately, each Hadoop distribution(CHD or HDP etc.) has its own specific 
jars. So, we can build specific image for specific Hadoop distribution, which 
will make image management task more easier. This will have following two 
benefits:
+
+- Someone who has better knowledge on Hadoop can do this work, and let kylin 
user build their Kylin image base on provided Hadoop-Client image.
+- Upgrade Kylin will be much easier.
+
+Build Step
+- Prepare and modify Dockerfile(If you are using other hadoop distribution, 
please consider build image yourself). 
+- Place Spark binary(such as `spark-2.3.2-bin-hadoop2.7.tgz`) into dir 
`provided-binary`.
+- Run `build-image.sh` to build image.
+
+### Kylin-client image
+ 
+What is kylin-client docker images? 
+
+**kylin-client** is a docker image which based on **hadoop-client**, it will 
provided the flexibility of upgrade of Apache Kylin.
+
+Build Step
+
+- Place Kylin binary(such as `apache-kylin-3.0.1-bin-cdh57.tar.gz`) and 
uncompress it into current dir.
+- Modify `Dockerfile` , change the value of `KYLIN_VERSION` and name of base 
image(hadoop-client).
+- Run `build-image.sh` to build image.
+
+----
+
+## How to deploy kylin on kubernetes
+
+Here let's take a look of how to deploy a kylin cluster which connect to CDH 
5.7.
+
+1 `kubenetes/template/production/example/deployment` is the working directory.
+
+2 Update hadoop configuration files 
(`kubenetes/template/production/example/config/hadoop`) and filebeat 's 
configuration file.
+
+3 Create statefulset and service for memcached.
+
+- Apply kubernetes objects.
+```
+$ kubectl apply -f memcached/
+service/cache-svc created
+statefulset.apps/kylin-memcached created
+```
+- Check hostname of cache service.
+``` 
+$ kubectl run -it--image=busybox:1.28.4--rm--restart=Never sh -n test-dns
+If you don't see a command prompt, try pressing enter.
+/ # nslookup cache-svc.kylin-example.svc.cluster.local
+Server: 10.96.0.10
+Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
+Name:   cache-svc.kylin-example.svc.cluster.local
+Address 1: 192.168.11.44 
kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local
+/ #
+```
+
+4 Create statefulset and service for Apache Kylin.
+- Modify memcached configuration.
+``` 
+// modify memcached hostname(session sharing)
+// 
memcachedNodes="n1:kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211"
+$ vim ../config/tomcat/context.xml
+// modify memcached hostname(query cache)
+// 
kylin.cache.memcached.hosts=kylin-memcached-0.cache-svc.kylin-example.svc.cluster.local:11211
+$ vim ../config/kylin-job/kylin.properties
+$ vim ../config/kylin-query/kylin.properties
+```
+- Create configMap
+``` 
+$ kubectl create configmap -n kylin-example hadoop-config \
+--from-file=../config/hadoop/core-site.xml \
+--from-file=../config/hadoop/hdfs-site.xml \
+--from-file=../config/hadoop/yarn-site.xml \
+--from-file=../config/hadoop/mapred-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hive-config \
+--from-file=../config/hadoop/hive-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example hbase-config \
+--from-file=../config/hadoop/hbase-site.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-more-config \
+--from-file=../config/kylin-more/applicationContext.xml \
+--from-file=../config/kylin-more/ehcache.xml \
+--from-file=../config/kylin-more/ehcache-test.xml \
+--from-file=../config/kylin-more/kylinMetrics.xml \
+--from-file=../config/kylin-more/kylinSecurity.xml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-job-config  \
+--from-file=../config/kylin-job/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-job/kylin_hive_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf.xml \
+--from-file=../config/kylin-job/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-job/kylin-server-log4j.properties \
+--from-file=../config/kylin-job/kylin-spark-log4j.properties \
+--from-file=../config/kylin-job/kylin-tools-log4j.properties \
+--from-file=../config/kylin-job/kylin.properties \
+--from-file=../config/kylin-job/setenv.sh \
+--from-file=../config/kylin-job/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example kylin-query-config  \
+--from-file=../config/kylin-query/kylin-kafka-consumer.xml \
+--from-file=../config/kylin-query/kylin_hive_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf.xml \
+--from-file=../config/kylin-query/kylin_job_conf_inmem.xml \
+--from-file=../config/kylin-query/kylin-server-log4j.properties \
+--from-file=../config/kylin-query/kylin-spark-log4j.properties \
+--from-file=../config/kylin-query/kylin-tools-log4j.properties \
+--from-file=../config/kylin-query/kylin.properties \
+--from-file=../config/kylin-query/setenv.sh \
+--from-file=../config/kylin-query/setenv-tool.sh \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example filebeat-config  \
+--from-file=../config/filebeat/filebeat.yml \
+--dry-run -o yaml | kubectl apply -f -
+$ kubectl create configmap -n kylin-example tomcat-config  \
+--from-file=../config/tomcat/server.xml \
+--from-file=../config/tomcat/context.xml \
+--dry-run -o yaml | kubectl apply -f -
+```
+- Deploy Kylin's Job server
+```
+$ kubectl apply -f kylin-job/
+service/kylin-job-svc created
+statefulset.apps/kylin-job created
+```
+- Deploy Kylin's Query server
+``` 
+$ kubectl apply -f kylin-query/
+service/kylin-query-svc created
+statefulset.apps/kylin-query created
+```
+
+5 Kylin Service
+
+- Visit Web UI
+  - http://${HOSTNAME}:30012/kylin for Query Server
+
+6 Clean up
+
+``` 
+$ kubectl delete -f memcached/
+$ kubectl delete -f kylin-query/
+$ kubectl delete -f kylin-job/
+```
+
+## Troubleshooting
+- Check logs of specific pod
+```
+//  Output of : sh kylin.sh start
+$ kubectl logs kylin-job-0 kylin -n kylin-example
+$ kubectl logs -f kylin-job-0 kylin -n kylin-example
+```
+ 
+- Attach to a specific pod, say "kylin-job-0".   
+``` 
+$ kubectl exec -it  kylin-job-0  -n kylin-example-- bash
+```   
+
+- Check failure reasons of specific pod
+``` 
+$ kubectl get pod kylin-job-0  -n kylin-example -o yaml
+```
+
+- If you don't have a Elasticsearch cluster or not interested in log 
collection, please remove filebeat container in both kylin-query-stateful.yaml 
and kylin-job-stateful.yaml.
+
+- If you want to check detail or want to have a discussion, please read or 
comment on [KYLIN-4447 Kylin on kubernetes in production 
env](https://issues.apache.org/jira/browse/KYLIN-4447) .
+
+- Find provided docker image at: DockerHub: : 
[apachekylin/kylin-client](https://hub.docker.com/r/apachekylin/kylin-client)
\ No newline at end of file

Reply via email to