Skip to content

Commit ab18262

Browse files
hddongyaooqinn
authored andcommitted
[KYUUBI apache#844] Exposing Kyuubi as a NodePort service
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html 2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'. 3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'. --> ### _Why are the changes needed?_ <!-- Please clarify why the changes are needed. For instance, 1. If you add a feature, you can talk about the use case of it. 2. If you fix a bug, you can clarify why it is a bug. --> `kubectl port-forward` usually use to test, use `NodePort` to visit kyuubi service in pod. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [X] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request Closes apache#858 from hddong/kyuubi-844. Closes apache#844 d149226 [hongdongdong] modify comments 72d51d6 [hongdongdong] fix comments 9172798 [hongdongdong] fix a169332 [hongdongdong] fix comments 74cec93 [hongdongdong] [KYUUBI#844]Use NodePort to expose kyuubi port on k8s Authored-by: hongdongdong <hongdongdong@cmss.chinamobile.com> Signed-off-by: Kent Yao <yao@apache.org>
1 parent bf8de1a commit ab18262

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@
1717

1818
# Usage:
1919
# Start:
20-
# kubectl apply -f https://raw.githubusercontent.com/apache/incubator-kyuubi/master/docker/example.yaml
21-
# Connect:
20+
# kubectl apply -f https://raw.githubusercontent.com/apache/incubator-kyuubi/master/docker/kyuubi-pod.yaml
21+
# Expose port:
22+
# 1. Expose the Pod by port-forward, for temporary test
2223
# kubectl port-forward kyuubi-example --address localhost 10009:10009
23-
# Or
24-
# kubectl exec -it kyuubi-example -- /bin/bash
24+
# Connect:
25+
# kubectl exec -it kyuubi-example -- /bin/bash
2526
#
26-
# ${SPARK_HOME}/bin/beeline -u 'jdbc:hive2://localhost:10009'
27+
# ${SPARK_HOME}/bin/beeline -u 'jdbc:hive2://localhost:10009'
28+
# 2. Expose the Pod as a service with NodePort
29+
# see usage of kyuubi-service.yaml
2730
# Logging
2831
# kubectl logs -f kyuubi-example
2932

3033
apiVersion: v1
3134
kind: Pod
3235
metadata:
3336
name: kyuubi-example
37+
labels:
38+
app: kyuubi-server
3439
spec:
3540
containers:
3641
- name: kyuubi-server

docker/kyuubi-service.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Usage:
19+
# Start:
20+
# kubectl apply -f https://raw.githubusercontent.com/apache/incubator-kyuubi/master/docker/kyuubi-service.yaml
21+
# Connect:
22+
# ${SPARK_HOME}/bin/beeline -u 'jdbc:hive2://${any_hostname_of_k8s_nodes}:30009'
23+
24+
apiVersion: v1
25+
kind: Service
26+
metadata:
27+
name: kyuubi-example-service
28+
spec:
29+
ports:
30+
# The default port limit is 30000-32767
31+
# to change:
32+
# vim kube-apiserver.yaml (usually under path: /etc/kubernetes/manifests/)
33+
# add or change line 'service-node-port-range=1-32767' under kube-apiserver
34+
- nodePort: 30009
35+
# same of containerPort in pod yaml
36+
port: 10009
37+
protocol: TCP
38+
type: NodePort
39+
selector:
40+
# same of pod label
41+
app: kyuubi-server

0 commit comments

Comments
 (0)