K8s Installation - philipf/notebook GitHub Wiki

Installation (Ubuntu)

1. Setup Docker and K8s repos

Installation of GPG keys might be required. See docker and K8s documentation to install relevant repos.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

2. Install Package

The following packages are required and needs to be installed on the Master and Nodes A package manager like apt install can work.

The version should match the other k8s packages.

docker-ce

Docker community edition

kubelet

Manages containers running on a single host.

kubeadm

Helps to install at k8s cluster

kubectl

Is a command line tool for controlling Kubernetes clusters

sudo apt-get update
sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu kubelet=1.13.5-00 kubeadm=1.13.5-00 kubectl=1.13.5-00
# Exclude these packages from updates
sudo apt-mark hold docker-ce kubelet kubeadm kubectl

Enable iptable bridge call:

Not sure why yet. According to: https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#network-plugin-requirements

echo "net.bridge.bridge-nf-call-iptables=1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

On the Master

Initialize the cluster with kubeadm

sudo kubeadm init --prod-network-cidr=10.244.0.0/16

This produce a message such as:

Your Kubernetes master has initialized successfully!
...
...

Install Flannel network:

(I don't understand why yet)

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

On the Nodes

Follow these instructions and copy the kubeadm join command and run on every node

Verify the configuration

On the Master kubectl get nodes

It should show something like this (for 1 Master and 2 Nodes)

ubuntu@ip-172-31-24-255:~$ kubectl get nodes
NAME               STATUS   ROLES    AGE   VERSION
ip-172-31-20-139   Ready    <none>   69s   v1.13.5
ip-172-31-24-255   Ready    master   26m   v1.13.5
ip-172-31-28-23    Ready    <none>   79s   v1.13.5
⚠️ **GitHub.com Fallback** ⚠️