Riguz留言 | 贡献
Riguz留言 | 贡献
第31行: 第31行:
# /dev/vdb /var xfs  defaults 0 0
# /dev/vdb /var xfs  defaults 0 0
</syntaxhighlight>
</syntaxhighlight>
== System configuration ==
Enable ipv4 forward:<ref>https://kubernetes.io/docs/setup/production-environment/container-runtimes/#forwarding-ipv4-and-letting-iptables-see-bridged-traffic</ref>
<syntaxhighlight lang="bash">
# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
EOF
# Apply sysctl params without reboot
sudo sysctl --system
</syntaxhighlight>
Verify:
<syntaxhighlight lang="bash">
$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
</syntaxhighlight>
== Disable swap ==
<syntaxhighlight lang="bash">
# check if swap is disabled
swapon -s
</syntaxhighlight>
= Install Kubernetes =


[[Category:Linux/Unix]]
[[Category:Linux/Unix]]
[[Category:Kubernetes]]
[[Category:Kubernetes]]

2025年4月27日 (日) 14:05的版本

System preparation

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.2 LTS"

Updrage

sudo apt update
sudo apt upgrade
do-release-upgrade

(Optional) Mount data disk

mkfs.xfs /dev/vdb
lsof /var
mv /var/ /var0
mkdir /mnt/newvar/
mount /dev/vdb /mnt/newvar/
rsync -aqxP /var0/* /mnt/newvar/
umount /mnt/newvar
mkdir /var
mount /dev/vdb /var

vim /etc/fstab
# /dev/vdb /var xfs  defaults 0 0

System configuration

Enable ipv4 forward:[1]

# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system

Verify:

$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

Disable swap

# check if swap is disabled
swapon -s

Install Kubernetes