summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-07-17 16:12:37 +0800
committerYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-07-19 11:08:23 +0800
commit5a02d498bb9f62f0620cf0ea3e25455dc7b8ddb3 (patch)
tree4697c2a2875aadfdcd046f9c08b7a3677af029a0 /utils
parentc4e5626d4ecf05a1b72b4bd0ab8f5c83245b0305 (diff)
Add kubectl installation for jump server
Bottlenecks container does not support kubectl. This patch is to add installation script. Change-Id: I4e066aaffd0dda76b91b71a35e515a78acd5d823 Signed-off-by: Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/kube_setup/__init__.py0
-rw-r--r--utils/kube_setup/install_kubectl.sh33
2 files changed, 33 insertions, 0 deletions
diff --git a/utils/kube_setup/__init__.py b/utils/kube_setup/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/utils/kube_setup/__init__.py
diff --git a/utils/kube_setup/install_kubectl.sh b/utils/kube_setup/install_kubectl.sh
new file mode 100644
index 00000000..14f97f2b
--- /dev/null
+++ b/utils/kube_setup/install_kubectl.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2018 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+OS_TYPE=$(uname -a)
+OS_UBUNTU=$(echo $OS_TYPE | grep ubuntu)
+
+if [[ $OS_UBUNTU ]]; then
+ apt-get update && apt-get install -y apt-transport-https
+ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
+ touch /etc/apt/sources.list.d/kubernetes.list
+ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
+ apt-get update
+ apt-get install -y kubectl
+else
+ cat <<EOF > /etc/yum.repos.d/kubernetes.repo
+[kubernetes]
+name=Kubernetes
+baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
+enabled=1
+gpgcheck=1
+repo_gpgcheck=1
+gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
+EOF
+ yum install -y kubectl
+fi
+