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:
Role | IP | Components on this server |
---|---|---|
master | 192.168.56.10 |
|
node01 | 192.168.56.11 |
|
node02 | 192.168.56.12 |
|
Server Preparations #
- 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
andeth0
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 aHost-only
network: theNAT
network is for internet access to download resources, while theHost-only
network allows interconnection between virtual machines. In this case, the primary network interface is theHost-only
interface, which will handle communication between the Kubernetes Nodes.
- If you are using VirtualBox, you may see a
It’s recommended to ping each server from the others to ensure inter-node connectivity.
Next: K8s certificates and keys。