https://kubernetes.io/ko/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
# ํ์ฌ ์์คํ ์ ์ ์ฉ(๋ฆฌ๋ถํ ํ๋ฉด ์ฌ ์ค์ ํ์) sudo swapoff -a # ๋ฆฌ๋ถํ ํ์ sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# using Docker Repository
sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
# install contaierd
sudo apt update
sudo apt install -y containerd.io
sudo systemctl status containerd
# Containerd configuration for Kubernetes
# ์ปจํ
์ด๋d ๋ฐํ์ ๋ฑ๋ก
# SystemdCgroup: ๋์ปค๋ค์์คํ์ด์ค๋ฅผ ์ฟ ๋ฒ๋คํฐ์ค์ ๊ณต์ ํ๊ธฐ ์ํ ์ค์
cat <<EOF | sudo tee -a /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
EOF
sudo sed -i 's/^disabled_plugins \=/\#disabled_plugins \=/g' /etc/containerd/config.toml
sudo systemctl restart containerd
# ์์ผ์ด ์๋์ง ํ์ธ
ls /var/run/containerd/containerd.sock
- apt ํจํค์ง ์์ธ์ ์ ๋ฐ์ดํธํ๊ณ , ์ฟ ๋ฒ๋คํฐ์ค apt ๋ฆฌํฌ์งํฐ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๋ฐ ํ์ํ ํจํค์ง๋ฅผ ์ค์นํ๋ค.
sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl
- ๊ตฌ๊ธ ํด๋ผ์ฐ๋์ ๊ณต๊ฐ ์ฌ์ด๋ ํค๋ฅผ ๋ค์ด๋ก๋ ํ๋ค.
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
- ์ฟ ๋ฒ๋คํฐ์ค apt ๋ฆฌํฌ์งํฐ๋ฆฌ๋ฅผ ์ถ๊ฐํ๋ค.
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
- apt ํจํค์ง ์์ธ์ ์ ๋ฐ์ดํธํ๊ณ , kubelet, kubeadm, kubectl์ ์ค์นํ๊ณ ํด๋น ๋ฒ์ ์ ๊ณ ์ ํ๋ค.
sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl
๊ณ : Debian 12 ๋ฐ Ubuntu 22.04 ์ด์ ๋ฆด๋ฆฌ์ค์์๋ /etc/apt/keyrings์ด ๊ธฐ๋ณธ์ ์ผ๋ก ์กด์ฌํ์ง ์๋๋ค. ํ์ํ ๊ฒฝ์ฐ ์ด ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํ์ฌ, ๋๊ตฌ๋ ์ฝ์ ์ ์์ง๋ง ๊ด๋ฆฌ์๋ง ์ธ ์ ์๋๋ก ๋ง๋ค ์ ์๋ค.
cat <<EOF > kube_install.sh
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
EOF
sudo bash kube_install.sh
kubeadm version
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.20.04.1).
curl is already the newest version (7.68.0-1ubuntu2.19).
The following packages were automatically installed and are no longer required:
libatasmart4 libblockdev-fs2 libblockdev-loop2 libblockdev-part-err2 libblockdev-part2 libblockdev-swap2
libblockdev-utils2 libblockdev2 libmbim-glib4 libmbim-proxy libmm-glib0 libnspr4 libnss3 libnuma1
libparted-fs-resize0 libqmi-glib5 libqmi-proxy libudisks2-0 libxmlb2 usb-modeswitch usb-modeswitch-data
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 21 not upgraded.
Need to get 1704 B of archives.
After this operation, 162 kB of additional disk space will be used.
Get:1 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-updates/universe amd64 apt-transport-https all 2.0.9 [1704 B]
Fetched 1704 B in 0s (21.0 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 62245 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.0.9_all.deb ...
Unpacking apt-transport-https (2.0.9) ...
Setting up apt-transport-https (2.0.9) ...
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Err:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
404 Not Found [IP: 142.250.76.142 443]
Fetched 8993 B in 1s (6544 B/s)
Reading package lists... Done
E: Failed to fetch https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/by-hash/SHA256/0d7ba2a5a480b51e90c78214afbd41cb4211c23cc52c2497ebcfc3f1bb8e7e31 404 Not Found [IP: 142.250.76.142 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package kubelet
E: Unable to locate package kubeadm
E: Unable to locate package kubectl
E: Unable to locate package kubelet
E: Unable to locate package kubeadm
E: Unable to locate package kubectl
E: No packages found
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt-get update sudo apt-get install kubelet kubeadm kubectl sudo apt-get update
sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://asia-northeast3.gce.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Ign:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
Err:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages
404 Not Found [IP: 142.250.76.142 443]
Fetched 8993 B in 2s (5979 B/s)
Reading package lists... Done
E: Failed to fetch https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/by-hash/SHA256/0d7ba2a5a480b51e90c78214afbd41cb4211c23cc52c2497ebcfc3f1bb8e7e31 404 Not Found [IP: 142.250.76.142 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.
kubernets.list ํ์ผ ํ์ธํด๋ณด๋ URL์ ์ ์์ ์ผ๋ก ์์ฑ๋์ด์๋ค.. ๊ทธ๋์ ๋ค์ update๋ฅผ ํ๋๊น ์ด๋ฒ์ ์ฑ๊ณตํจ..
๊ทธํsudo apt-get install kubelet kubeadm kubectl
ํ๋ ์ฑ๊ณต
sudo -i
sudo modprobe br_netfilter echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
exit
sudo kubeadm init
: ์ต์
์ ์ค์ ์ปจํธ๋กค ํ๋ ์ธ์ ์ฌ๋ฌ๊ฐ ๋ง๋ค์ ์์. (๋ง์คํฐ๋ฅผ ๋๋ ์ด์)
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
sudo kubeadm join 10.178.0.2:6443 --token 5mjpzx.trk8jvqeuyecyt0g \
--discovery-token-ca-cert-hash sha256:efa7e790d83179e19dbc5635dc21573d2095c5e1fe61080b0cd32f67d86ded5d
https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/
์ปจํ
์ด๋์ ํ๋๊ฐ ํต์ ์ ํ ๋ ์ฐ๋ ๋๊ตฌ ์ธํ
curl -LO https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz sudo tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin rm cilium-linux-amd64.tar.gz cilium install
ํ๋๊ฐ ์ค์น๋์ด์ ready ์ํ๋ก ๋ณ๊ฒฝ๋จ