3 # Copyright 2018 ZTE, Inc.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 echo "************install docker************"
19 sudo apt-get install -y docker.io
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
29 read -p "Install kubelet (y/n)?" choice
31 y|Y ) sudo apt-get install -y kubelet=1.11.1-00;;
35 read -p "Install kubeadm (y/n)?" choice
37 y|Y ) sudo apt-get install -y kubeadm=1.11.1-00;;
41 read -p "Install kubectl (y/n)?" choice
43 y|Y ) sudo apt-get install -y kubectl=1.11.1-00;;
47 read -p "Install helm (y/n)?" choice
50 wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
51 tar -zxvf helm-v2.9.1-linux-amd64.tar.gz
52 chmod o+x linux-amd64/helm
53 sudo mv linux-amd64/helm /usr/local/bin/helm
55 rm -rf helm-v2.9.1-linux-amd64.tar.gz
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
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:
68 scp root@<master ip>:/etc/kubernetes/admin.conf .
69 kubectl --kubeconfig ./admin.conf get nodes
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 ########################################################################################################################