Cluster: Worker Node
Last updated
Last updated
# Edit the resolv.conf file
sudo nano /etc/resolv.conf
#File: /etc/resolv.conf
nameserver 10.100.1.1
nameserver 192.168.1.1
# Update apt package index
sudo apt update
# Install resolvconf
sudo apt install resolvconf
# Request the status from service resolvconf
sudo systemctl status resolvconf.service
# Edit the head file
sudo nano /etc/resolvconf/resolv.conf.d/head
#File /etc/resolvconf/resolv.conf.d/head
nameserver 10.100.1.1
nameserver 192.168.1.1
# Start the service resolvconf again
sudo systemctl start resolvconf.service
# Try to ping google.ch
ping google.ch
# Try to make an nslookup command on google.ch
nslookup google.ch
# Load the br_netfilter module
sudo modprobe br_netfilter
# Make sure, that the br_netfilter module is loaded
lsmod | grep br_netfilter
# As a requirement for your Linux Node's iptables to correctly see bridged traffic
# you should ensure net.bridge.bridge-nf-call-iptables is set to 1
# Edit the sysctl file
sudo nano /etc/sysctl.conf
#File: /etc/sysctl.conf
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
# Request the entry
sudo sysctl --system
# Edit the fstab file
sudo nano /etc/fstab
# Disable the swap-partition
sudo swapoff -a
# Update the apt package index
sudo apt-get update
# Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Set up the stable repository (x86_64 / amd64)
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update the apt package index
sudo apt-get update
#Install the latest version of Docker Engine and containerd
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Configure the Docker daemon, in particular to use systemd for the management of the container’s cgroups
sudo mkdir /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
# Restart Docker and enable on boot
sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker
# Update the apt package index
sudo apt-get update
# Install packages needed to use the Kubernetes apt repository
sudo apt-get install -y apt-transport-https ca-certificates curl
# Download the Google Cloud public signing key
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
# Add the Kubernetes apt repository
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
# Update apt package index
sudo apt-get update
# Install kubelet, kubeadm, kubectl
sudo apt-get install -y kubelet kubeadm kubectl
# Pin their version
sudo apt-mark hold kubelet kubeadm kubectl
# Join any number of worker nodes
kubeadm join 10.100.1.155:6443 --token s5z4yi.dv8df1bhsr5ihnwn \
--discovery-token-ca-cert-hash sha256:0c9e75101944003b9bf2d4a216df7a69d109f5aecbc6b02bb85828145e0ff094