Server Preparations

Server Preparations #

This section documents the tasks required for the server preparation stage.

Information #

Preparation requirements:

  • 3 Linux servers; here, we are using Rocky Linux 8.
  • 3 IP addresses on the same subnet, assigned to these servers.

The planned setup is as follows:

RoleIPComponents on this server
master192.168.56.10
  • etcd
  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler
node01192.168.56.11
  • containerd
  • runc
  • kubelet
node02192.168.56.12
  • containerd
  • runc
  • kubelet

Server Preparations #

  1. Set hostnames
hostnamectl set-hostname master
hostnamectl set-hostname node01
hostnamectl set-hostname node02

Edit /etc/hosts so that the servers can be accessed with hostnames

# /etc/hosts

192.168.56.10 master
192.168.56.11 node01
192.168.56.12 node02

Set timezone.

timedatectl set-timezone <YOUR_TIMEZONE>
timedatectl set-timezone <YOUR_TIMEZONE>
timedatectl set-timezone <YOUR_TIMEZONE>

Install some useful command line tools.

# master: openssl
dnf install -y wget vim openssl
# node: some tools that may be useful
dnf install -y wget vim socat conntrack ipset
# node: some tools that may be useful
dnf install -y wget vim socat conntrack ipset

Disable SWAP and SELinux

# Do this on all three nodes.

vim /etc/fstab
vim /etc/selinux/config

Enable ip_forward (so that the nodes can forward packets to pods.)

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

Create folders for config and certs.

mkdir /etc/kubernetes       # config
mkdir /etc/kubernetes/pki   # certs and keys
mkdir /etc/kubernetes       # config
mkdir /etc/kubernetes/pki   # certs and keys
mkdir /etc/kubernetes       # config
mkdir /etc/kubernetes/pki   # certs and keys

Notes on Networking #

Run ip addr on each hosts.

  • If only lo and eth0 are displayed on your machine, then for this configuration, your primary network interface is eth0.

  • If you have more than these two network interfaces, you are likely using a virtual machine on your computer:

    • If you are using VirtualBox, you may see a NAT network and a Host-only network: the NAT network is for internet access to download resources, while the Host-only network allows interconnection between virtual machines. In this case, the primary network interface is the Host-only interface, which will handle communication between the Kubernetes Nodes.

It’s recommended to ping each server from the others to ensure inter-node connectivity.

Next: K8s certificates and keys

comments powered by Disqus