You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ya...@apache.org on 2021/07/14 12:00:45 UTC

[incubator-kyuubi] branch master updated: Run kyuubi on kubernetes - make basic dockerfile and example (#795)

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

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e16ddb  Run kyuubi on kubernetes - make basic dockerfile and example (#795)
5e16ddb is described below

commit 5e16ddb1b5f8b7e9a8c42a52c3d42272f7c7ea45
Author: Kent Yao <ya...@apache.org>
AuthorDate: Wed Jul 14 20:00:37 2021 +0800

    Run kyuubi on kubernetes - make basic dockerfile and example (#795)
    
    * Run kyuubi on kubernetes - make basic dockerfile and example
    
    * Run kyuubi on kubernetes - make basic dockerfile and example
    
    * Run kyuubi on kubernetes - make basic dockerfile and example
    
    * Run kyuubi on kubernetes - make basic dockerfile and example
    
    * Run kyuubi on kubernetes - make basic dockerfile and example
    
    * Revert "Set protected_branches explicitly in a nonstrict way (#793)"
    
    This reverts commit b16533a972cd6bea083f0259c121616831647f9c.
    
    * Revert "Revert "Set protected_branches explicitly in a nonstrict way (#793)""
    
    This reverts commit 57f5f6cf9c010ed177bdf0cd446902feb68c14dd.
    
    * adress comments
---
 build/dist          |  1 +
 docker/Dockerfile   | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 docker/example.yaml | 46 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/build/dist b/build/dist
index 03d54ca..89a8732 100755
--- a/build/dist
+++ b/build/dist
@@ -224,6 +224,7 @@ fi
 
 cp -r "$KYUUBI_HOME/bin" "$DISTDIR"
 cp -r "$KYUUBI_HOME/conf" "$DISTDIR"
+cp -r "$KYUUBI_HOME/docker" "$DISTDIR"
 
 if [[ "$MAKE_TGZ" == "true" ]]; then
   TARDIR_NAME=kyuubi-$VERSION-bin-$NAME
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..266352a
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,60 @@
+#
+# 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.
+#
+
+# Usage:
+#   1. use ./build/dist to make binary distributions of Kyuubi or download a release
+#   2. Untar it and run the docker command below
+#      docker build -f docker/Dockerfile -t yaooqinn/kyuubi:tagname .
+#   Options:
+#     -f this docker file
+#     -t the target repo and tag name
+#     more options can be found with -h
+# TODO: REPALCE it with offical spark image iff Apache Spark community deploy
+# Or make one after kyuubi to be setup under ASF
+
+ARG SPARK_IMAGE=yaooqinn/spark:3.0.3
+FROM ${SPARK_IMAGE}
+
+ARG kyuubi_uid=10009
+
+USER root
+
+ENV KYUUBI_HOME /opt/kyuubi
+ENV KYUUBI_LOG_DIR ${KYUUBI_HOME}/logs
+ENV KYUUBI_PID_DIR ${KYUUBI_HOME}/pid
+ENV KYUUBI_WORK_DIR_ROOT ${KYUUBI_HOME}/work
+
+RUN set -ex && \
+    sed -i 's/http:\/\/deb.\(.*\)/https:\/\/deb.\1/g' /etc/apt/sources.list && \
+    apt-get update && \
+    apt install -y bash tini libc6 libpam-modules krb5-user libnss3 procps && \
+    useradd -u ${kyuubi_uid} -g root kyuubi && \
+    mkdir -p ${KYUUBI_HOME} ${KYUUBI_LOG_DIR} ${KYUUBI_PID_DIR} ${KYUUBI_WORK_DIR_ROOT} && \
+    chmod ug+rw -R ${KYUUBI_HOME} && \
+    chmod a+rwx -R ${KYUUBI_WORK_DIR_ROOT} && \
+    rm -rf /var/cache/apt/*
+
+COPY bin ${KYUUBI_HOME}/bin
+COPY conf ${KYUUBI_HOME}/conf
+COPY jars ${KYUUBI_HOME}/jars
+COPY externals/engines/spark ${KYUUBI_HOME}/externals/engines/spark
+
+WORKDIR ${KYUUBI_HOME}
+
+CMD [ "./bin/kyuubi", "run" ]
+
+USER ${kyuubi_uid}
diff --git a/docker/example.yaml b/docker/example.yaml
new file mode 100644
index 0000000..c070b97
--- /dev/null
+++ b/docker/example.yaml
@@ -0,0 +1,46 @@
+#
+# 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.
+#
+
+# Usage:
+# Start:
+#   kubectl apply -f https://raw.githubusercontent.com/apache/incubator-kyuubi/master/docker/example.yaml
+# Connect:
+#   kubectl port-forward kyuubi-example --address localhost 10009:10009
+# Or
+#   kubectl exec -it kyuubi-example -- /bin/bash
+#
+#   ${SPARK_HOME}/bin/beeline -u 'jdbc:hive2://localhost:10009'
+# Logging
+#   kubectl logs -f kyuubi-example
+
+apiVersion: v1
+kind: Pod
+metadata:
+  name: kyuubi-example
+spec:
+  containers:
+    - name: kyuubi-server
+      # TODO: replace this with the official repo
+      image: yaooqinn/kyuubi:1.3.0
+      imagePullPolicy: IfNotPresent
+      env:
+        - name: KYUUBI_JAVA_OPTS
+          value: -Dkyuubi.frontend.bind.host=0.0.0.0
+      ports:
+        - name: frontend-port
+          containerPort: 10009
+          protocol: TCP