-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathinstallk8s-latest.sh
51 lines (42 loc) · 2.01 KB
/
installk8s-latest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#/bin/bash
echo " Running script with $(whoami)"
echo " STEP 1: Disabling Swap"
# First diasbale swap
sudo swapoff -a
# And then to disable swap on startup in /etc/fstab
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
echo " -> Done"
echo " STEP 2: Installing apt-transport-https"
apt-get install -y apt-transport-https 1>/dev/null
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list
echo " -> Done"
echo " STEP 3: Updating apt"
apt-get update 1>/dev/null
echo " -> Updated ...."
echo " STEP 4: Starting Docker Deamon and enable Service....."
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh 1>/dev/null
echo " STEP 5: C-Group Error Fix and Restarting Components"
echo "{ \n \"exec-opts\": [\"native.cgroupdriver=systemd\"]\n}" > /etc/docker/daemon.json
systemctl daemon-reload
systemctl restart docker
rm /etc/containerd/config.toml
systemctl restart containerd
echo " -> Done"
echo " STEP 6: Installing kubenetes master components"
echo " -> Installing kubelet"
apt-get install -y kubelet 1>/dev/null
echo " -> Installing kubeadm"
apt-get install -y kubeadm 1>/dev/null
echo " -> Installing kubectl"
apt-get install -y kubectl 1>/dev/null
echo " -> Installing kubernetes-cni"
apt-get install -y kubernetes-cni 1>/dev/null
echo "-----------------------------------------------------------"
echo " Kubernetes node template is now created "
echo " Create AMI form this node to create worker nodes"
echo " Action --> Image --> Create Image"
echo " Note: This node will be your master node "
echo "-----------------------------------------------------------"
exit