Ubuntu 26.04

Kubernetes : Kubeadm インストール2026/05/12

 

マルチノード Kubernetes クラスターを構成します。

当例では以下のように 4 台のノードを使用して設定します。

前提条件として、各ノードの [Hostname], [MAC address], [Product_uuid] は一意である必要があります。
[MAC address] と [Product_uuid] は、通常の物理マシンや一般的な方法で作成した仮想マシンであれば、通常は一意となっています。
[Product_uuid] は [dmidecode -s system-uuid] コマンドで確認できます。

+----------------------+   +----------------------+
|  [ ctrl.srv.world ]  |   |   [ dlp.srv.world ]  |
|     Manager Node     |   |     Control Plane    |
+-----------+----------+   +-----------+----------+
        eth0|10.0.0.25             eth0|10.0.0.30
            |                          |
------------+--------------------------+-----------
            |                          |
        eth0|10.0.0.51             eth0|10.0.0.52
+-----------+----------+   +-----------+----------+
| [ node01.srv.world ] |   | [ node02.srv.world ] |
|     Worker Node#1    |   |     Worker Node#2    |
+----------------------+   +----------------------+

[1] Manager ノードを除く Kubernetes クラスターを構成する全ノードで、システム要件を満たすよう各設定を適用しておきます。
root@dlp:~#
apt -y install containerd curl gpg
root@dlp:~#
mkdir /etc/containerd

root@dlp:~#
containerd config default | tee /etc/containerd/config.toml

root@dlp:~#
vi /etc/containerd/config.toml
# 51行目 : 変更
sandbox = 'registry.k8s.io/pause:3.10.1'

# 109行目 : 変更
SystemdCgroup = true

root@dlp:~#
systemctl restart containerd.service
root@dlp:~#
cat > /etc/sysctl.d/99-k8s-cri.conf <<EOF
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
EOF
root@dlp:~#
sysctl --system
# UFW と swap は要無効化

root@dlp:~#
ufw disable

root@dlp:~#
swapoff -a

root@dlp:~#
vi /etc/fstab
# swap 行はコメント化
#/swap.img      none    swap    sw      0       0
[2] Manager ノードを除く Kubernetes クラスターを構成する全ノードで Kubeadm, Kubelet をインストールします。
root@dlp:~#
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

root@dlp:~#
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
root@dlp:~#
apt update

root@dlp:~#
apt -y install kubeadm kubelet kubectl
root@dlp:~#
ln -s /opt/cni/bin /usr/lib/cni
関連コンテンツ