promote Jinquan ni as MSB commiter and ptl
[msb/service-mesh.git] / install / 2_install_k8s_minion.sh
1 #!/bin/sh
2 #
3 # Copyright 2018 ZTE, Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # 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 echo "************install docker************"
18 sudo apt-get update
19 sudo apt-get install -y docker.io
20
21 echo "*************set up kubernetes apt-get source************"
22 sudo apt-get update && sudo apt-get install -y apt-transport-https
23 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
24 cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
25 deb http://apt.kubernetes.io/ kubernetes-xenial main
26 EOF
27 sudo apt-get update
28
29 read -p "Install kubelet (y/n)?" choice
30 case "$choice" in
31   y|Y ) sudo apt-get install -y kubelet=1.11.1-00;;
32 esac
33 printf "\n"
34
35 read -p "Install kubeadm (y/n)?" choice
36 case "$choice" in
37   y|Y ) sudo apt-get install -y kubeadm=1.11.1-00;;
38 esac
39 printf "\n"
40
41 read -p "Install kubectl (y/n)?" choice
42 case "$choice" in
43   y|Y ) sudo apt-get install -y kubectl=1.11.1-00;;
44 esac
45 printf "\n"
46
47 read -p "Install helm (y/n)?" choice
48 case "$choice" in
49   y|Y )
50     wget https://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz
51     tar -zxvf helm-v2.8.2-linux-amd64.tar.gz
52     chmod o+x linux-amd64/helm
53     sudo mv linux-amd64/helm /usr/local/bin/helm
54     rm -rf linux-amd64
55     rm -rf helm-v2.8.2-linux-amd64.tar.gz
56     ;;
57 esac
58 printf "\n"
59
60 cat << EOF
61 ########################################################################################################################
62 1. You can now join this machines by running "kubeadmin join" command as root:
63 Please note that this is just an example, please refer to the output of the "kubeamin init" when cteating the k8s master for the exact comand to use in your k8s cluter!!!
64   kubeadm join 10.12.6.108:6443 --token 43utwe.inl7h8dxn26p26iv --discovery-token-ca-cert-hash sha256:54cc1bcf72218de70c6b98edf4d486f79fb6d921a92ac5b7d10c76dbf96d006f
65
66 2. If you would like to get kubectl talk to your k8s master, you need to copy the dministrator kubeconfig file from your master to your workstation like this:
67
68 scp root@<master ip>:/etc/kubernetes/admin.conf .
69 kubectl --kubeconfig ./admin.conf get nodes
70
71 or you can manually copy the content of this file to ~/.kube/conf if scp can't be used due to security reason.
72 ########################################################################################################################
73
74 EOF