hostname 변경
hostnamectl set-hostname node1.example.com
hostnamectl set-hostname node2.example.com
hostnamectl set-hostname node3.example.com
hostnamectl set-hostname loadbalancer.example.com
IP 변경 및 적용
nm-connection-editor &
nmcli connection up ens33 && systemctl restart NetworkManager
---
master 192.168.45.60
node1 192.168.45.61
node2 192.168.45.62
node3 192.168.45.63
loadbalancer 192.168.45.80
적용 확인
[root@node1 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.45.61 netmask 255.255.255.0 broadcast 192.168.45.255
inet6 fe80::20c:29ff:fe48:d0d1 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:48:d0:d1 txqueuelen 1000 (Ethernet)
RX packets 867010 bytes 1293662586 (1.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 46024 bytes 2850595 (2.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 255 bytes 26638 (26.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 255 bytes 26638 (26.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@node1 ~]# nslookup www.google.com
Server: 168.126.63.1
Address: 168.126.63.1#53
Non-authoritative answer:
Name: www.google.com
Address: 142.250.76.132
Name: www.google.com
Address: 2404:6800:400a:80e::2004
PS1 환경 변수 설정
[root@node1 ~]# gedit .bashrc &
[1] 3560
---
# 맨 마지막 줄 PS1 환경변수 변경
# export PS1='\[\e[31;1m\][\u@\h\[\e[31;1m\] \w]# \[\e[m\]'
export PS1="[\u@\h \$PWD]# "
---
[root@node1 ~]# source .bashrc
[1]+ 완료 gedit .bashrc
[root@node1 /root]#
[root@master ~]# ping -c 1 192.168.45.61
PING 192.168.45.61 (192.168.45.61) 56(84) bytes of data.
64 bytes from 192.168.45.61: icmp_seq=1 ttl=64 time=1.40 ms
--- 192.168.45.61 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.398/1.398/1.398/0.000 ms
[root@master ~]# ping -c 1 192.168.45.62
PING 192.168.45.62 (192.168.45.62) 56(84) bytes of data.
64 bytes from 192.168.45.62: icmp_seq=1 ttl=64 time=0.725 ms
--- 192.168.45.62 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.725/0.725/0.725/0.000 ms
[root@master ~]# ping -c 1 192.168.45.63
PING 192.168.45.63 (192.168.45.63) 56(84) bytes of data.
64 bytes from 192.168.45.63: icmp_seq=1 ttl=64 time=4.35 ms
--- 192.168.45.63 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 4.350/4.350/4.350/0.000 ms
[root@master ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:x6ckdW6eugMJT3tmIMujlzqfDKqHcM1foVtBMY1YQl8 root@master.example.com
The key's randomart image is:
+---[RSA 3072]----+
| .oo++E |
| .ooo. |
| .. . . |
| o =o o |
| o . BS*+ + |
|. . o = B++= . |
|.o .o * =. o |
|. ..oo=. .. |
|.o. .=+ oo |
+----[SHA256]-----+
[root@master ~]# ls /root/.ssh
id_rsa id_rsa.pub
▶ id_rsa : 비밀키 → 암호화 풀 때 사용 : 나만 가지고 있어야 함
▶ id_rsa.pub : 공개키 → 암호화 할 때 사용 : 서로 공유하고 있어야 함
hosts 정보 확인
[root@master ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.45.60 master.example.com master
192.168.45.61 node1.example.com node1
192.168.45.62 node2.example.com node2
192.168.45.63 node3.example.com node3
192.168.45.70 minikube.example.com minikube
192.168.45.80 loadbalancer.examlple.com loadbalancer
공개키 배포
※ kubernetes 관련 요소들을 master 에도 설치해야 하므로 자기 자신한테도 공개키 배포 必
▶ master, node1, node2, node3 에 배포
[root@master ~]# ssh-copy-id master
The authenticity of host 'master (192.168.45.60)' can't be established.
ED25519 key fingerprint is SHA256:rDIryZ74C9jPKpyqqeR7AKfcd/F6fMREHFOVCHazN3k.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@master's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'master'"
and check to make sure that only the key(s) you wanted were added.
[root@master ~]# ssh-copy-id node1
The authenticity of host 'node1 (192.168.45.61)' can't be established.
ED25519 key fingerprint is SHA256:rDIryZ74C9jPKpyqqeR7AKfcd/F6fMREHFOVCHazN3k.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: master
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node1's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'node1'"
and check to make sure that only the key(s) you wanted were added.
[root@master ~]# ssh-copy-id node2
The authenticity of host 'node2 (192.168.45.62)' can't be established.
ED25519 key fingerprint is SHA256:rDIryZ74C9jPKpyqqeR7AKfcd/F6fMREHFOVCHazN3k.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: master
~/.ssh/known_hosts:4: node1
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'node2'"
and check to make sure that only the key(s) you wanted were added.
[root@master ~]# ssh-copy-id node3
The authenticity of host 'node3 (192.168.45.63)' can't be established.
ED25519 key fingerprint is SHA256:rDIryZ74C9jPKpyqqeR7AKfcd/F6fMREHFOVCHazN3k.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: master
~/.ssh/known_hosts:4: node1
~/.ssh/known_hosts:5: node2
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node3's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'node3'"
and check to make sure that only the key(s) you wanted were added.
공개키 배포 확인
비밀번호 없이 노드 간 접속 가능
[root@master ~]# ssh root@master
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Thu Mar 20 18:27:20 2025
[root@master ~]# ssh root@node1
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Thu Mar 20 17:50:26 2025
[root@node1 /root]#
kubernetes의 경우, swap memory 사용 X
master, node1, node2, node3 에 모두 적용
[root@master ~]# free
total used free shared buff/cache available
Mem: 1785008 504684 1189152 2076 242948 1280324
Swap: 2113532 649308 1464224
[root@master ~]# swapoff -a
[root@master ~]# free
total used free shared buff/cache available
Mem: 3714368 1829448 1804716 30340 339740 1884920
Swap: 0 0 0
node1, node2, node3 에 적용
[root@node1 /root]# systemctl set-default multi-user.target
Removed "/etc/systemd/system/default.target".
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
[root@node2 /root]# systemctl isolate multi-user.target
▶ 그래픽 모드 사용하지 않고 console 만 사용하도록 설정