CentOS Stream 9
Sponsored Link

Kubernetes : Configure Manager Node2023/10/19

 

Configure Multi Nodes Kubernetes Cluster.

This example is based on the environment like follows.

For System requirements, each Node has unique Hostname, MAC address, Product_uuid.
MAC address and Product_uuid are generally already unique one if you installed OS on physical machine or virtual machine with common procedure.
You can see Product_uuid with the command [dmidecode -s system-uuid].

+----------------------+   +----------------------+
|   [ mgr.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] Configure Manager Node first.
[root@mgr ~]#
dnf -y install nginx nginx-mod-stream
[root@mgr ~]#
vi /etc/nginx/nginx.conf
    server {
    	# line 38 : change listening port
        listen       8080;
        listen       [::]:8080;

# add to the end : proxy settings
stream {
    upstream k8s-api {
        server 10.0.0.30:6443;
    }
    server {
        listen 6443;
        proxy_pass k8s-api;
    }
}

[root@mgr ~]#
systemctl enable --now nginx
[2] If SELinux is enabled, change policy like follows.
[root@mgr ~]#
setsebool -P httpd_can_network_connect on

[root@mgr ~]#
setsebool -P httpd_graceful_shutdown on

[root@mgr ~]#
setsebool -P httpd_can_network_relay on

[root@mgr ~]#
setsebool -P nis_enabled on

[root@mgr ~]#
semanage port -a -t http_port_t -p tcp 6443

[3] If Firewalld is running, allow related services.
[root@mgr ~]#
firewall-cmd --add-service={kube-apiserver,http,https}

success
[root@mgr ~]#
firewall-cmd --runtime-to-permanent

success
[4] On Manager Node, Install Kubernetes client.
Replace the version number with the one you want to install.
[root@mgr ~]#
cat <<'EOF' > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/
enabled=0
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/repodata/repomd.xml.key
EOF

[root@mgr ~]#
dnf --enablerepo=kubernetes -y install kubectl
Matched Content