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 kubectli=1.11.1-00;;
47 echo "*************dry run to test kubeadm.conf************"
48 sudo kubeadm init --config kubeadm.conf --dry-run
50 read -p "Create kubernetees master(y/n)?" choice
53 sudo kubeadm init --config kubeadm.conf
55 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
56 sudo chown $(id -u):$(id -g) $HOME/.kube/config
57 sudo chmod o+wr $HOME/.kube/config
62 read -p "Install calico network plugin (y/n)?" choice
64 y|Y ) kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml;;
68 read -p "Install helm (y/n)?" choice
71 wget https://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz
72 tar -zxvf helm-v2.8.2-linux-amd64.tar.gz
73 chmod o+x linux-amd64/helm
74 sudo mv linux-amd64/helm /usr/local/bin/helm
76 rm -rf helm-v2.8.2-linux-amd64.tar.gz
78 kubectl create -f helm_service_account.yaml
79 helm init --service-account tiller