-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0-PackageInstallation.sh
54 lines (40 loc) · 1.85 KB
/
0-PackageInstallation.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
52
53
54
#Setup
# 1. 3 VMs Ubuntu 16.04.5 or 18.04.1.0, 1 master, 2 nodes.
# 2. Static IPs on individual VMs
# 3. /etc/hosts hosts file includes name to IP mappings for VMs
# 4. Swap is disabled
# 5. Take snapshots prior to installations, this way you can install
# and revert to snapshot if needed
https://medium.com/better-programming/kubernetes-from-scratch-4691283e3995
#Disable swap, swapoff then edit your fstab removing any entry for swap partitions
#You can recover the space with fdisk. You may want to reboot to ensure your config is ok.
swapoff -a
vi /etc/fstab
# Optionall update the hostname
vi /etc/hostname
# Install openssh server
apt-get install openssh-server
#Add Google's apt repository gpg key
apt-get install apt-transport-https curl httpie -y
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
#Add the Kubernetes apt repository
sudo bash -c 'cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF'
#Update the package list and use apt-cache to inspect versions available in the repository
sudo apt-get update
apt-cache policy kubelet | head -n 20
apt-cache policy docker.io | head -n 20
#Install the required packages, if needed we can request a specific version
sudo apt-get install -y docker.io kubelet kubeadm kubectl
sudo apt-mark hold docker.io kubelet kubeadm kubectl
#Add the below line to the file
cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
Environment="cgroup-driver=systemd/cgroup-driver=cgroupfs"
#Check the status of our kubelet and our container runtime, docker.
#The kubelet will enter a crashloop until it's joined.
sudo systemctl status kubelet.service
sudo systemctl status docker.service
#Ensure both are set to start when the system starts up.
sudo systemctl enable kubelet.service
sudo systemctl enable docker.service