kubernetes가 설치되는 시스템들은 아래와 같은 설정이 필요하다.
1. swap 사용하지 않도록 구성
2. br_netfilter 모듈 활성화
3. bridge-nf-call-iptables, ip_forward 활성화
4. 시스템에 kubernetes repo 등록
5. containerd 설치
6. kubernetes 관련 프로그램 설치
Swap 비활성화
- swapoff 명령어로 기존 설정된 swap 해제
root@ubuntu2004-001:~# free
total used free shared buff/cache available
Mem: 4026028 187576 1929316 1208 1909136 3542052
Swap: 4025340 0 4025340
root@ubuntu2004-001:~# swapoff /swap.img
root@ubuntu2004-001:~# free
total used free shared buff/cache available
Mem: 4026028 194080 1922616 1208 1909332 3535584
Swap: 0 0 0
- /etc/fstab에서 리부팅 시, swap을 사용하지 않도록 설정
root@ubuntu2004-001:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/vda2 during curtin installation
/dev/disk/by-uuid/9a5e5ad1-ef89-4fd3-a0f1-128ce2bb614a / ext4 defaults 0 1
#/swap.img none swap sw 0 0
br_netfilter 모듈 활성화
# cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
# modprobe br_netfilter
bridge-nf-call-iptables, ip_forward 활성화
# cat << EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
# sysctl --system
containerd 설치
# apt install -y containerd
시스템에 kubernetes repo 등록
# apt-get install -y apt-transport-https ca-certificates curl
# curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
# echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
kubernetes 관련 프로그램 설치
# apt-get update
# apt-get install -y kubelet kubeadm kubectl
# apt-mark hold kubelet kubeadm kubectl
관련 레퍼런스는 아래 사이트를 참고한다.
- https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
- On-Primise Kubernets 1.21 구축(VirtualBox or VIRT) - 01. 구성 환경
- On-Primise Kubernets 1.21 구축(VirtualBox or VIRT) - 03. cluster 구성
- On-Primise Kubernets 1.21 구축(VirtualBox or VIRT) - 04. metalLB 구성