Kubernetes : Manager ノードの設定2025/01/22 |
|
マルチノード Kubernetes クラスターを構成します。 当例では以下のように 4 台のノードを使用して設定します。
前提条件として、各ノードの [Hostname], [MAC address], [Product_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 ノードを設定します。 |
|
[root@ctrl ~]#
dnf -y install nginx nginx-mod-stream
[root@ctrl ~]#
vi /etc/nginx/nginx.conf
server {
# 38行目 : 待ち受けポート変更
listen 8080;
listen [::]:8080;
# 最終行に追記 : プロキシの設定
stream {
upstream k8s-api {
server 10.0.0.30:6443;
}
server {
listen 6443;
proxy_pass k8s-api;
}
}
[root@ctrl ~]# systemctl enable --now nginx
|
| [2] | SELinux を有効にしている場合は、ポリシーの変更が必要です。 |
|
[root@ctrl ~]# setsebool -P httpd_can_network_connect on [root@ctrl ~]# setsebool -P httpd_graceful_shutdown on [root@ctrl ~]# setsebool -P httpd_can_network_relay on [root@ctrl ~]# setsebool -P nis_enabled on [root@ctrl ~]# semanage port -a -t http_port_t -p tcp 6443 |
| [3] | Firewalld を有効にしている場合は、サービスポートの許可が必要です。 |
|
[root@ctrl ~]# firewall-cmd --add-service={kube-apiserver,http,https} success [root@ctrl ~]# firewall-cmd --runtime-to-permanent success |
| [4] | Manager ノードに Kubernetes クライアントをインストールしておきます。 バージョン番号は、インストールしたいバージョン番号に置き換えてください。 |
|
[root@ctrl ~]# cat <<'EOF' > /etc/yum.repos.d/kubernetes.repo
[root@ctrl ~]# [kubernetes] name=Kubernetes baseurl=https://pkgs.k8s.io/core:/stable:/v1.32/rpm/ enabled=0 gpgcheck=1 gpgkey=https://pkgs.k8s.io/core:/stable:/v1.32/rpm/repodata/repomd.xml.key EOF dnf --enablerepo=kubernetes -y install kubectl
|
| Sponsored Link |
|
|