Kubeadm 실습을 위해서 아래 사진과 같이 하드웨어 준비를 하였다.

- 스위칭허브

- 라즈베리파이 4개

- 전원장치

- 와이파이

 

 

이제 라즈베리파이에 라즈비안 설치를 시작해볼까!

 

여러가지 방법중에서 Raspberry Pi Imager 를 이용하여 쉽고 빠르게 설치해보았다.

 

https://www.raspberrypi.org/software/

 

Raspberry Pi OS – Raspberry Pi

The Raspberry Pi is a tiny and affordable computer that you can use to learn programming through fun, practical projects. Join the global Raspberry Pi community.

www.raspberrypi.org

 

첫째, 라즈베리파이 공식 홈페이지에서 맥용 Raspberry Pi Imager를 다운로드 받는다.

 

Raspberry Pi Imager를 이용하여 SD 카드에 라즈비언을 설치한다.

- Operation System : Raspberry Pi OS(32-BIT)

- Storage : SD card

 

라즈베리 파이 1대에 설치 완료까지 약 5분 정도 소요되었다.. 

 

라즈비안의 기본적인 환경세팅(언어 설정, 키보드 설정 ..)은 라즈비언에서 가이드 해주는대로 하면 큰 문제 없이 완료할 수 있을 것이다.

 

 

둘째, 이제 SSH로 접속하여 고정 IP를 부여해보자.

 

DHCP로 IP를 할당받게되면 작업할때마다 IP가 바뀔 수 있기 때문에 4개의 라즈베리 파이에 고정 IP를 부여해야한다.

 

혹시 라지브언에 SSH server가 disable 되어있다면 enable 하자.

- sudo raspi-config를 통해 관련 설정을 할 수 있었다.

 

모든 라즈베리파이에 유선으로 인터넷을 연결 할 것이기 때문에 eth0 네트워크 인터페이스에 대해서 네트워크 설정을 추가할 것이다.

 

자신의 유선 네트워크 인터페이스를 모르겠다면 ifconfig 명령을 통해 네트워크 정보를 확인하자.

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.123.200  netmask 255.255.255.0  broadcast 192.168.123.255
        inet6 fe80::7876:9c60:88d4:ccde  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:a4:4f:42  txqueuelen 1000  (Ethernet)
        RX packets 24722  bytes 15151148 (14.4 MiB)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 6056  bytes 637019 (622.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

또한, netstat -nr 명령을 통해서 게이트웨이 주소를 알아낸다.

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.123.254 0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.123.254 0.0.0.0         UG        0 0          0 wlan0
192.168.123.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.123.0   0.0.0.0         255.255.255.0   U         0 0          0 wlan0

 

처음 고정 IP 설정을 하기위해서 /etc/network/interfaces 필요한 내용을 입력하려고 했으나, 고정 IP 설정은 되었으나 인터넷 연결이 제대로 되지않았다.

 

참고) 네트워크 대역(network)은 192.168.123.0 ~ 192.168.123.255 를 의미한다.

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

auth eth0
iface eth0 inet static
address 192.168.123.200
netmask 255.255.255.0
gateway 192.168.123.254
network 192.168.123.0
broadcast 8.8.8.8 # DNS server

 

파일 가장 위 부분에 고정 IP 설정을 위해서 /etc/dhcpcd.conf 에 필요한 내용을 입력하라고 안내하고있다. 느낌에 /etc/dhcpcd.conf가 /etc/network/interfaces를 overwrite 한다는 느낌을 받았다.

 

각  라즈비언의  네트워크 설정파일(/etc/dhcpcd.conf)에 아래 내용을 추가한다.
interface eth0
static ip_address=192.168.123.200/24
static routers=192.168.123.254
static domain_name_servers=192.168.123.254 8.8.8.8
reboot을 통해 변경내용을 반영한다.
sudo reboot

 

이 모든 작업이 완료되면 앞으로는 다음과 같이 라즈비언에 접속하여 원하는 작업을 할 수 있을 것이다.

 

 

셋째, ssh pi@192.168.123.x 그리고 로그인!

 

맥에서 4대의 라즈비언에 접속한 화면

 

다음주는 Kubeadm 설치에 대해서 살펴볼 예정!


출처

- https://d-tail.tistory.com/4

- https://dullwolf.tistory.com/18

- https://ng1004.tistory.com/105

- https://superuser.com/questions/99949/what-does-network-mean-in-the-etc-network-interfaces-file

- https://www.raspberrypi.org/software/

+ Recent posts