IP는 172.0.0.0으로 표기함.
실제 사용되는 IP와 SUBNET을 적용바람.
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo chmod -R 777 /etc/apt
$ cat <<EOF> /etc/apt/sources.list.d/kubernetes.list
> deb http://apt.kubernetes.io/ kubernetes-xenial main
> EOF
$ wget -qO- get.docker.com | sh
$ sudo apt-get update
$ sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
구문 뒤에 --exec-opt native.cgroupdriver=systemd
를 추가
$ sudo vi /lib/systemd/system/docker.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --exec-opt native.cgroupdriver=systemd
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ sudo kubeadm init --apiserver-advertise-address 0.0.0.0 --pod-network-cidr=172.0.0.0/16 --ignore-preflight-errors=ALL
Your Kubernetes control-plane has initialized successfully!
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
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:
kubeadm join 172.0.0.0:6443 --token gs5zbb.lwpwcaghege7a6cs \
--discovery-token-ca-cert-hash sha256:0885f23cdbf64b621c53c0c230bd938adf0da057e8039331ae4b6490343bb0ca
kubeadm join 172.0.0.0:6443 --token gs5zbb.lwpwcaghege7a6cs \ --discovery-token-ca-cert-hash sha256:0885f23cdbf64b621c53c0c230bd938adf0da057e8039331ae4b6490343bb0ca
은 worker node에서 master node에 연결하기 위한 명령어$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-0-0-0 NotReady control-plane,master 7m13s v1.23.4
$ sudo kubeadm reset
$ sudo kubeadm join 172.0.0.0:6443 --token p46o53.yf40pnp8mbsd4efe \
--discovery-token-ca-cert-hash sha256:8464611730f9c9ad87d814993643085146acfbbddddd6bdf28a2ed63a59897eb --ignore-preflight-errors=ALL
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-0-0-1 NotReady <none> 6m34s v1.23.4
ip-172-0-0-0 NotReady control-plane,master 28m v1.23.4
ip-172-0-0-2 NotReady <none> 12m v1.23.4
$ wget https://docs.projectcalico.org/v3.22/manifests/calico.yaml
$ sed -i -e 's?192.168.0.0/16?172.0.0.0/16?g' calico.yaml
$ kubectl apply -f calico.yaml
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-0-0-1 Ready <none> 33m v1.23.4
ip-172-0-0-0 Ready control-plane,master 115m v1.23.4
ip-172-0-0-2 Ready <none> 99m v1.23.4