There are 3 readme.md files (steps) in this repo. This one shows how to install. The second step configures the cluster. The third step sets up monitoring with Lens.
Check out the kubernetes_glossary.pdf for reference on any terms
- Three servers running an Ubuntu OS I used a VM and 2 physical PC's reimaged
- Minimum 2 GB RAM and 2 Core CPUs on each node
- A root password configured on each server
First, update the system packages with the following command:
sudo apt-get update
First, turn swap off:
swapoff -a
Edit permanently
nano /etc/fstab
Comment out #/swapfile
Next, edit the /etc/sysctl.conf file to enable the IP forwarding:
nano /etc/sysctl.conf
Uncomment this line below "net.ipv4.ip_forward = 1"
Apply settings
sysctl -p
Kubernetes requires Docker to be installed on the system. Install Docker with the following commands:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
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"
sudo apt-get install docker-ce -y
Now, install Kubernetes with the following commands:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -y
sudo apt-get install kubelet kubeadm kubectl -y
Next, you will need to update the cgroupdriver
nano /etc/docker/daemon.json
Add the following lines:
{ "exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts":
{ "max-size": "100m" },
"storage-driver": "overlay2"
}
Save and reload:
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
sudo kubeadm init --pod-network-cidr=10.69.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Your cubeadm join command should look like this:
kubeadm join 192.168.1.1:6989 --token blahhhxx5t2f66cpqz8e --discovery-token-ca-cert-hash shaxxxxxxxxxxxxxxxxxxxx
kubectl get pods --all-namespaces