✏️ Container 가상화 기술
- Kubernetes 는 Container 가상화 기술을 기반으로 작동된다.
- Kubernetes 는 CRI 라고하는 인터페이스를 사용해 아래의 Contaginer 가상화 기술을 사용할 수 있다.
- Docker
- Containerd
- 연습 환경에서는 해당 기술을 사용할 얘정이다.
- cri-o
- 아래 세팅은 하나의 서버에서 연습할 때 필요한 세팅으로,
프로젝트에 적용하려면 아래의 준비만 하면 된다.
- firewalld 비활성화 → Containerd 활성화 → Selinux 비활성화
✏️ 기본 세팅
📍 Host name 변경하기
- Host name 은 각 서버를 식별하기 위한 식별값이다.
- master 로 사용할 서버의 host name 을 master 로 변경해주면 유지보수하기 편리하다.
- root 계정으로 접속해야 하는데 아래 명령어로 확인할 수 있다.
whoami
su root
sudo passwd root
- 아래 명령어로 host name 을 변경할 수 있다.
- 기존 name 을 지우고 master 로 수정해준다.
vim /etc/hostname
📍 DNS 수정하기
- 지금 상태에서 ping master 로 확인해도 찾을 수 없다고한다.
- 문제를 해결하기 위해서 hosts 파일도 수정해준다.
vim /etc/hosts
- 내 서버의 public ip 주소와 master 를 입력해주면 된다.
- 이렇게 수정한 뒤 ping master 를 입력하면 정상적으로 통신이 되는것을 확인할 수 있다.

- 참고로 shell 의 host 이름을 수정한 master 로 나오도록 하려면 아래 명령어로 재부팅 시켜주면 된다.
reboot now
📍 방화벽 비활성화
- 보통 cloud server 의 방화벽은 비활성화 되어있긴하지만,
혹시 모르니 한번 더 확인해준다.
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
📍 EPEL 패키지 세팅
yum install epel-release
yum update -y
📍 Docker 설치
- Containerd 와 cri-o 는 이미지를 실행할 수 만 있고, 생성은 할 수 없기 때문에
편의상 Docker 도 설치 해줘야 한다.
- 아래 링크의 docker install 명령어엔 containerd 까지 포함되어있어 추가로 설치해주지 않아도 된다.
- 🔗 server 기본 세팅
📍 Containerd 활성화
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install containerd.io -y
apt-get update
apt-get install -y containerd
systemctl start containerd
systemctl enable containerd
- 아래 명령어를 입력해 Kubernetes 가 CRI 를 통해 Containerd 를 사용할 수 있도록 설정해준다.
- ubuntu 의 경우 해당 경로를 생성해주면 된다.
containerd config default > /etc/containerd/config.toml
vi /etc/containerd/config.toml
SystemdCgroup
를 true 로 활성화 시켜주면 됨
esc
+ /
+ 검색어 를 입력하면 해당 문서내 특정 워드를 검색할 수 있다.
SystemdCgroup = true
- 수정이 완료되면 Contanerd 를 재실행 해주면 된다.
systemctl restart containerd
📍 Selinux 비활성화
⚠️ ubuntu 라면 비활성화가 기본값이기 때문에 생략하면 된다.
sudo setenforce 0
- 재부팅 후에도 selinux 가 활성화 되지 않게 설정하기 위해선 아래 명령어를 입력하면 된다.
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
- 설정파일에서 SELINUX=disabled 로 되어있으면 성공이다.
- 아래 명령어를 입력해 현재 상태를 확인할 수 있다.
cat /etc/selinux/config