- 2 vCPUs for Master, 1 CPU for Worker
- 4G RAM
- 30G storage
- Ubuntu iso
- Set the default network adapter to connect to the “Bridged adapter” to enable traffic between the VM and the host machine.
- Change to Root
sudo su
- Turn off swap
swapoff -a
Edit /ect/fstab to comment out the line
#UUID=d0200036-b211-4e6e-a194-ac2e51dfb27d none swap sw
- Configure iptables to add new 3 lines
vi /etc/ufw/sysctl.conf
net/bridge/bridge-nf-call-ip6tables = 1
net/bridge/bridge-nf-call-iptables = 1
net/bridge/bridge-nf-call-arptables = 1
-
Reboot
-
Install ebtables and ethtool
sudo su
apt-get install ebtables ethtool
- Reboot
- Change to Root
sudo su
- Install Docker
apt-get install -y docker.io
- Install Curl
apt-get install curl
- Retrieve the key for the Kubernetes repo and add it to your key manager
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- Add the kubernetes repo
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
- Update and install kubeadm, kubelet, kubectl
apt-get update
apt-get install -y kubelet kubeadm kubectl
- Check
Reinitialize the MAC address of all network cards
- Full clone
- Change to Root
sudo su
- Modify /etc/hosts Add Master and all workers IP in each machine.
192.168.1.x master
192.168.1.y worker-y
192.168.1.z worker-z
- Set hostname
vi /etc/hostname
Change default to specific name.
- Init kubeadm with Calico CNI
kubeadm init --pod-network-cidr=192.168.0.0/16
Remember the token in output to join a node later.
- Start cluster
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
- Install Calico network plugin.
kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
- Untaint the master so that it will be available for scheduling workloads
kubectl taint nodes --all node-role.kubernetes.io/master-
- Install ssh
sudo apt-get install openssh-server
- Enable service
sudo service ssh status
- Access to worker node and execute the command with token above
ssh username@worker-ip-address
sudo su
kubeadm join...
Get nodes:
sudo kubectl get nodes