Difference between revisions of "Cka kubeadm init upgrade"
Jump to navigation
Jump to search
Line 17: | Line 17: | ||
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml | sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml | ||
sudo systemctl restart containerd | sudo systemctl restart containerd | ||
+ | echo "net.ipv4.ip_forward = 1" | /etc/sysctl.d/k8s.conf | ||
+ | sudo sysctl --system | ||
curl -fsSL https://pkgs.k8s.io/core:/stable:/v${k8s_minor_version}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | curl -fsSL https://pkgs.k8s.io/core:/stable:/v${k8s_minor_version}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | ||
Line 33: | Line 35: | ||
lsmod | grep overlay | lsmod | grep overlay | ||
lsmod | grep br_netfilter | lsmod | grep br_netfilter | ||
− | |||
− | |||
− | |||
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bashrc | echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bashrc |
Revision as of 06:53, 4 January 2025
Init Ubuntu 24.04 & 22.04
#!/bin/bash set -eu k8s_minor_version=1.31 prep_k8s_node(){ sudo apt update && sudo apt upgrade -y sudo apt install apt-transport-https curl -y sudo apt install containerd -y sudo mkdir -p /etc/containerd containerd config default | sudo tee /etc/containerd/config.toml > /dev/null # Instruct containerd to use the Systemd cgroup hierarchy (typically cgroupv2) for managing container resources. sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml sudo systemctl restart containerd echo "net.ipv4.ip_forward = 1" | /etc/sysctl.d/k8s.conf sudo sysctl --system curl -fsSL https://pkgs.k8s.io/core:/stable:/v${k8s_minor_version}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${k8s_minor_version}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo apt update sudo apt install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl swapon -s # returns summary text if swap is enabled sudo swapoff -a sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab # overlay is modprobed by containerd sudo modprobe br_netfilter echo -e "br_netfilter" | sudo tee /etc/modules-load.d/k8s.conf lsmod | grep overlay lsmod | grep br_netfilter echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bashrc sudo reboot } prep_k8s_node