06B. Vagrant์ kubeadm์ผ๋ก ๊ฐ์๋จธ์ ์ ํด๋ฌ์คํฐ ๊ตฌ์ถํ๊ธฐ
06B. Vagrant์ kubeadm์ผ๋ก ๊ฐ์๋จธ์ ์ ํด๋ฌ์คํฐ ๊ตฌ์ถํ๊ธฐ ๊ด๋ จ
.VirtualBox์ Vagrant ์ค์น๊ฐ ๋๋ฌ์ผ๋ฉด ๋ณธ๊ฒฉ์ ์ผ๋ก ์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ๋ฅผ ๊ตฌ์ถํด๋ณด๊ฒ ์ต๋๋ค. ์ด๋ฒ์ ๊ตฌ์ถํ ํด๋ฌ์คํฐ์ ํํ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- Vagrant๋ก VirtualBox ๊ฐ์๋จธ์ ์์ฑ
- Vagrant๋ก
containerd
๋ฐkubeadm
์ค์น - master ๋ ธ๋์ worker ๋ ธ๋๋ฅผ ์๋์ผ๋ก ์ฐ๊ฒฐ
๋ ธ๋
ํด๋ฌ์คํฐ๋ฅผ ๊ตฌ์ฑํ๋ ์๋ฒ(๋จธ์ )๋ฅผ ๋ ธ๋(node)๋ผ๊ณ ๋ถ๋ฆ ๋๋ค. ๋ ธ๋๋ ๋ฌผ๋ฆฌ์๋ฒ์ผ ์๋ ์๊ณ , ๊ฐ์๋จธ์ ์ผ ์๋ ์์ต๋๋ค.
Vagrantfile
์์ฑํ๊ธฐ
์ด์ Vagrant ์ฝ๋๋ฅผ ์์ฑํด๋ณด๊ฒ ์ต๋๋ค. ๋ค์ ๋ด์ฉ์ Vagrantfile
๋ก ์ ์ฅํฉ๋๋ค.
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 3000
config.vm.define "master" do |master|
master.vm.box = "ubuntu/jammy64"
master.vm.network "private_network", ip: "192.168.56.10"
master.vm.hostname = "master"
master.vm.provider "virtualbox" do |v|
v.memory = 4096
v.cpus = 4
end
master.vm.provision "0", type: "shell", preserve_order: true, privileged: true, inline: <<-EOC
cat <<-'EOF' >/etc/modules-load.d/kubernetes.conf
br_netfilter
EOF
sudo modprobe br_netfilter
cat <<-'EOF' >/etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
sudo apt update
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
cat <<-'EOF' >/etc/default/kubelet
KUBELET_EXTRA_ARGS=--node-ip=192.168.56.10
EOF
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | 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
OUTPUT_FILE=/vagrant/join.sh
rm -rf $OUTPUT_FILE
rm -rf /vagrant/.kube
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint=192.168.56.10 --apiserver-advertise-address=192.168.56.10
sudo kubeadm token create --print-join-command > $OUTPUT_FILE
chmod +x $OUTPUT_FILE
mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cp -R $HOME/.kube /vagrant/.kube
cp -R $HOME/.kube /home/vagrant/.kube
sudo chown -R vagrant:vagrant /home/vagrant/.kube
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
kubectl completion bash >/etc/bash_completion.d/kubectl
echo 'alias k=kubectl' >/home/vagrant/.bashrc
EOC
end
(1..3).each do |i|
config.vm.define "worker#{i}" do |worker|
worker.vm.box = "ubuntu/jammy64"
worker.vm.network "private_network", ip: "192.168.56.1#{i}"
worker.vm.hostname = "worker#{i}"
worker.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
worker.vm.provision "0", type: "shell", preserve_order: true, privileged: true, inline: <<-EOC
cat <<-'EOF' >/etc/modules-load.d/kubernetes.conf
br_netfilter
EOF
sudo modprobe br_netfilter
cat <<-'EOF' >/etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
sudo apt update
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
cat <<-'EOF' >/etc/default/kubelet
KUBELET_EXTRA_ARGS=--node-ip=192.168.56.1#{i}
EOF
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | 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
EOC
end
end
end
์ ํ ์ค๋ฆฌ์ฝ M ์๋ฆฌ์ฆ
๋งฅ์ CPU๊ฐ ์ธํ
์ด ์๋ ์ ํ ์ค๋ฆฌ์ฝ M ์๋ฆฌ์ฆ๋ผ๋ฉด ๋ค์ Vagrantfile
์ ์ฌ์ฉํฉ๋๋ค.
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 3000
config.vm.define "master" do |master|
master.vm.box = "jharoian3/ubuntu-22.04-arm64"
master.vm.box_version = "0.3"
master.vm.network "private_network", ip: "192.168.56.10"
master.vm.hostname = "master"
master.vm.provider "parallels" do |v|
v.memory = 4096
v.cpus = 4
end
master.vm.provision "0", type: "shell", preserve_order: true, privileged: true, inline: <<-EOC
swapoff -a
sed -i '/swap/ s/^/#/' /etc/fstab
cat <<-'EOF' >/etc/modules-load.d/kubernetes.conf
br_netfilter
EOF
sudo modprobe br_netfilter
cat <<-'EOF' >/etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
sudo apt update
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository -y "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
cat <<-'EOF' >/etc/default/kubelet
KUBELET_EXTRA_ARGS=--node-ip=192.168.56.10
EOF
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | 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
OUTPUT_FILE=/vagrant/join.sh
rm -rf $OUTPUT_FILE
rm -rf /vagrant/.kube
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint=192.168.56.10 --apiserver-advertise-address=192.168.56.10
sudo kubeadm token create --print-join-command > $OUTPUT_FILE
chmod +x $OUTPUT_FILE
mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cp -R $HOME/.kube /vagrant/.kube
cp -R $HOME/.kube /home/vagrant/.kube
sudo chown -R vagrant:vagrant /home/vagrant/.kube
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
kubectl completion bash >/etc/bash_completion.d/kubectl
echo 'alias k=kubectl' >/home/vagrant/.bashrc
EOC
end
(1..3).each do |i|
config.vm.define "worker#{i}" do |worker|
worker.vm.box = "jharoian3/ubuntu-22.04-arm64"
worker.vm.box_version = "0.3"
worker.vm.network "private_network", ip: "192.168.56.1#{i}"
worker.vm.hostname = "worker#{i}"
worker.vm.provider "parallels" do |v|
v.memory = 2048
v.cpus = 2
end
worker.vm.provision "0", type: "shell", preserve_order: true, privileged: true, inline: <<-EOC
swapoff -a
sed -i '/swap/ s/^/#/' /etc/fstab
cat <<-'EOF' >/etc/modules-load.d/kubernetes.conf
br_netfilter
EOF
sudo modprobe br_netfilter
cat <<-'EOF' >/etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
sudo apt update
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository -y "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
cat <<-'EOF' >/etc/default/kubelet
KUBELET_EXTRA_ARGS=--node-ip=192.168.56.1#{i}
EOF
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | 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
EOC
end
end
end
Parallels๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ๋ค์ ๋ช ๋ น์ผ๋ก ๊ฐ์๋จธ์ ์ ์์ฑํฉ๋๋ค.
vagrant up --provider=parallels
Minikube ํด๋ฌ์คํฐ
Minikube ํด๋ฌ์คํฐ๋ฅผ ์์ฑํ๋ค๋ฉด ๋ค์ ๋ช ๋ น์ผ๋ก ๋จผ์ Minikube ํด๋ฌ์คํฐ๋ฅผ ์ญ์ ํฉ๋๋ค.
minikube delete
Avast Antivirus ๊ฐ์ ์ ์ด ๋ฌธ์
Avast Antivirus ๋ฑ ์ํฐ๋ฐ์ด๋ฌ์ค ํ๋ก๊ทธ๋จ์ด ์ค์น๋์ด ์๋ ๊ฒฝ์ฐ vagrant up
๋ช
๋ น์ ์คํํ์ ๋ ๋ค์๊ณผ ๊ฐ์ ๋ฉ์์ง๊ฐ ์ถ๋ ฅ๋๋ฉด์ ์๋ฌ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ Avast ๊ฐ์ ์ ์ด ๊ธฐ๋ฅ์ ๋ฐ๋์ ๋๋๋ก ํฉ๋๋ค.
# Bringing machine 'master' up with 'virtualbox' provider...
# Bringing machine 'worker1' up with 'virtualbox' provider...
# Bringing machine 'worker2' up with 'virtualbox' provider...
# Bringing machine 'worker3' up with 'virtualbox' provider...
# ==> master: Box 'ubuntu/jammy64' could not be found. Attempting to find and install...
# master: Box Provider: virtualbox
# master: Box Version: >= 0
# The box 'ubuntu/jammy64' could not be found or
# could not be accessed in the remote catalog. If this is a private
# box on HashiCorp's Vagrant Cloud, please verify you're logged in via
# `vagrant login`. Also, please double-check the name. The expanded
# URL and error message are shown below:
#
# URL: ["https://vagrantcloud.com/ubuntu/jammy64"]
# Error: schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - ํด๋น ํจ์์์ ์ธ์ฆ์์ ๋ํ ํ๊ธฐ ์ฌ๋ถ๋ฅผ ๊ฒ์ฌํ์ง ๋ชปํ์ต๋๋ค.
vagrant up
๋ช
๋ น์ผ๋ก ๊ฐ์๋จธ์ ์ ์์ฑํฉ๋๋ค. ์๊ฐ์ด ๊ฝค ์ค๋ ๊ฑธ๋ฆฌ๋ฏ๋ก ๋๊ธํ๊ฒ ๊ธฐ๋ค๋ฆฝ๋๋ค.
vagrant up
SSH auth method: Private Key์์ ๋ฉ์ถ๋ ๊ฒฝ์ฐ
vagrant up
๋ช
๋ น์ผ๋ก ๊ฐ์๋จธ์ ์ ์์ฑํ ๋ SSH auth method: Private Key
์์ ๋ฉ์ถ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค.
vagrant up
๋ช
๋ น ์คํ์ด ๋๋ฌ์ผ๋ฉด vagrant status
๋ช
๋ น์ ์
๋ ฅํ์ฌ ๊ฐ์๋จธ์ ์ ์ํ๋ฅผ ํ์ธํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ํ์๋๋ฉด ์ ์์ ์ผ๋ก ์์ฑ๋ ๊ฒ์
๋๋ค.
vagrant status
#
# Current machine states:
#
# master running (virtualbox)
# worker1 running (virtualbox)
# worker2 running (virtualbox)
# worker3 running (virtualbox)
#
# This environment represents multiple VMs. The VMs are all listed
# above with their current state. For more information about a specific
# VM, run `vagrant status NAME`.
๋ง์คํฐ ๋ ธ๋ ํ์ธํ๊ธฐ
.Vagrantfile
์์ ๋ด์ฅ๋ ์คํฌ๋ฆฝํธ๋ก kubeadm
์คํ์ ํ์ํ ์ค์ ์ ํ๊ณ ํจํค์ง๋ค์ ์ค์นํ์ต๋๋ค. master ๋
ธ๋์๋ ์ ์ด ํ๋ ์ธ(Control Plane)์ด ๊ตฌ์ถ๋ ์ํ๊ณ , worker1, 2, 3 ๋
ธ๋์๋ kubeadm
๋ง ์ค์น๋ ์ํ์
๋๋ค.
๋ค์ ๋ช ๋ น์ ์คํํ์ฌ master ๋ ธ๋ ์์ผ๋ก ๋ค์ด๊ฐ๋๋ค.
vagrant ssh master
#
# Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic x86_64)
#
# * Documentation: https://help.ubuntu.com
# * Management: https://landscape.canonical.com
# * Support: https://ubuntu.com/advantage
#
# System information as of Sun Nov 6 17:35:51 UTC 2022
#
# System load: 0.5947265625 Users logged in: 0
# Usage of /: 9.0% of 38.70GB IPv4 address for cni0: 10.244.0.1
# Memory usage: 37% IPv4 address for enp0s3: 10.0.2.15
# Swap usage: 0% IPv4 address for enp0s8: 192.168.56.10
# Processes: 124
#
#
# 11 updates can be applied immediately.
# 10 of these updates are standard security updates.
# To see these additional updates run: apt list --upgradable
#
#
# Last login: Sun Nov 6 11:51:31 2022 from 10.0.2.2
# vagrant@master:~$
์๋์ฐ์์ vagrant ssh master ์คํ ์ Permission denied (publickey) ์๋ฌ ๋ฐ์ ๋ฌธ์
์๋์ฐ์์ vagrant ssh master
๋ช
๋ น์ ์คํํ์ ๋ vagrant@127.0.0.1: Permission denied (publickey). ์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค. ์ด๋๋ $env:VAGRANT_PREFER_SYSTEM_BIN += 0
๋ช
๋ น์ ์คํํ ๋ค vagrant ssh master
๋ช
๋ น์ ์คํํ๋ฉด ๋ฉ๋๋ค.
PowerShell
$env:VAGRANT_PREFER_SYSTEM_BIN += 0
vagrant ssh master
master ๋
ธ๋ ์์ผ๋ก ๋ค์ด์์ต๋๋ค. kubectl
๋ ์ค์นํด๋์์ผ๋ฏ๋ก kubectl get node
๋ช
๋ น์ผ๋ก ๋
ธ๋ ๋ชฉ๋ก์ ์ถ๋ ฅํด๋ด
๋๋ค.
kubectl get node
#
# NAME STATUS ROLES AGE VERSION
# master Ready control-plane 7m40s v1.28.4
master ๋
ธ๋ ํ๋๋ง ์์ฑ๋์ด ์๊ณ ๋กค์ ์ ์ด ํ๋ ์ธ(control-plane)์ธ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ์์ผ๋ก vagrant ssh
๋ก ๋ค์ด๊ฐ ๋
ธ๋์์ ๋น ์ ธ๋์ฌ ๋๋ Ctrl+D ํค๋ฅผ ์
๋ ฅํ๋ฉด ๋ฉ๋๋ค.
์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ ๊ตฌ์ถํ๊ธฐ
์ด์ ํฐ ๋ค์ด๊ฐ๋๋ค.
vagrant ssh worker1
cd /vagrant/
sudo ./join.sh
#
# [preflight] Running pre-flight checks
# [WARNING SystemVerification]: missing optional cgroups: blkio
# [preflight] Reading configuration from the cluster...
# [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
# [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
# [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
# [kubelet-start] Starting the kubelet
# [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
#
# This node has joined the cluster:
# * Certificate signing request was sent to apiserver and a response was received.
# * The Kubelet was informed of the new secure connection details.
#
# Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
.join.sh
ํ์ผ์ master ๋
ธ๋๋ฅผ ์์ฑํ ๋ค kubeadm join
๋ช
๋ น์ ๋ฏธ๋ฆฌ ์ ์ฅํด๋ ํ์ผ์
๋๋ค. ์ด ๋ถ๋ถ์ ๋ค์์ ์์ธํ ์ค๋ช
ํ๊ฒ ์ต๋๋ค.
์ ๋ช ๋ น๋ค์ worker2, worker3์๋ ๋๊ฐ์ด ์คํํฉ๋๋ค.
์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ ํ์ธํ๊ธฐ
vagrant ssh master
๋ช
๋ น์ ์คํํ์ฌ ๋ค์ master ๋
ธ๋๋ก ๋ค์ด๊ฐ๋๋ค. ๊ทธ๋ฆฌ๊ณ kubectl get node
๋ช
๋ น์ ์คํํด๋ด
๋๋ค.
vagrant ssh master
kubectl get node
#
# NAME STATUS ROLES AGE VERSION
# master Ready control-plane 19m v1.28.4
# worker1 Ready <none> 5m18s v1.28.4
# worker2 Ready <none> 68s v1.28.4
# worker3 Ready <none> 31s v1.28.4
master, worker1, 2, 3 ๋
ธ๋๊ฐ ๋ชจ๋ Ready
์ํ์ธ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ์ฟ ๋ฒ๋คํฐ์ค ํด๋ฌ์คํฐ ๊ตฌ์ถ์ด ๋๋ฌ์ต๋๋ค.
.kube
๋๋ ํฐ๋ฆฌ ์ค์ ํ๊ธฐ
.Vagrantfile
์ด ๋ค์ด์๋ ํด๋๋ฅผ ๋ณด๋ฉด join.sh
ํ์ผ ๋ง๊ณ ๋ .kube
ํด๋๊ฐ ๋ค์ด์๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ์ด ํด๋๋ฅผ ํธ์คํธ์ ์ฌ์ฉ์ ๊ณ์ ํด๋(๋๋ ํฐ๋ฆฌ๋ก) ๋ณต์ฌํ๋ฉด ๋
ธ๋ ๋ฐ๊นฅ์์๋ kubectl
๋ก ํด๋ฌ์คํฐ๋ฅผ ์ ์ดํ ์ ์์ต๋๋ค.
.kube ๋๋ ํฐ๋ฆฌ ๋ฐฑ์
์๋ ๋ช
๋ น์ ์คํํ๋ฉด ๊ธฐ์กด .kube/config
ํ์ผ์ ์ญ์ ํ๊ฑฐ๋ ๋ฎ์ด์ฐ๊ฒ ๋ฉ๋๋ค. ๋ฐ๋ผ์ ๊ธฐ์กด .kube
๋๋ ํฐ๋ฆฌ๋ ๋ฐฑ์
ํด์ฃผ์๊ธฐ ๋ฐ๋๋๋ค.
Copy-Item -Force -Recurse .\.kube C:\Users\${env:UserName}\
cp -R ./.kube ~/
์ด์ kubectl
๋ช
๋ น์ด ์ ์คํ๋๋์ง ํ
์คํธํด๋ด
๋๋ค.
kubectl get node
#
# NAME STATUS ROLES AGE VERSION
# master Ready control-plane 23m v1.28.4
# worker1 Ready <none> 91s v1.28.4
# worker2 Ready <none> 60s v1.28.4
# worker3 Ready <none> 31s v1.28.4
์๋์ฐ์์ Unable to connect to the server: net/http: TLS handshake timeout ์๋ฌ ๋ฐ์
์๋์ฐ์์ kubectl get node
๋ช
๋ น์ ์คํํ์ ๋ Unable to connect to the server: net/http: TLS handshake timeout ์๋ฌ๊ฐ ๋ฐ์ํ๋ค๋ฉด, $env:VAGRANT_PREFER_SYSTEM_BIN += 0
์ ์คํํ ๋ค kubectl get node
๋ช
๋ น์ ์คํํด์ค๋๋ค.
PowerShell
$env:VAGRANT_PREFER_SYSTEM_BIN += 0
kubectl get node