diff options
author | Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com> | 2018-08-09 13:07:31 +0800 |
---|---|---|
committer | Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com> | 2018-08-11 10:32:08 +0800 |
commit | 13fd26c9dfdfbe70eba3da738cc932814b072b92 (patch) | |
tree | 3cf0eec9d6c7bd82e9fe856c220626ef353a4467 /utils/k8s_setup/kubectl_install.sh | |
parent | 09df92d801b68dc42d7b9e39e3c718988b0c01c6 (diff) |
add k8s test configs preparation
JIRA: BOTTLENECK-243
Change-Id: I994c71f03c4c2429d62618920cfc92fc1ed16abe
Signed-off-by: Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'utils/k8s_setup/kubectl_install.sh')
-rw-r--r-- | utils/k8s_setup/kubectl_install.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/utils/k8s_setup/kubectl_install.sh b/utils/k8s_setup/kubectl_install.sh new file mode 100644 index 00000000..14f97f2b --- /dev/null +++ b/utils/k8s_setup/kubectl_install.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 + |