# sudo kubeadm init --control-plane-endpoint Floating_IP:port --upload-certs --pod-network-cidr=(Cluster 내부 IP 대역)
# pod-network-cidr은 원하는대로 설정해도 되지만 "https://github.com/flannel-io/flannel":flannel 에서 권장하는 대역은 10.244.0.0./16 이다.
# port는 haproxy 설정에 따라 달라진다.
sudo kubeadm init --control-plane-endpoint 192.168.192.168:16443 --upload-certs --pod-network-cidr=10.244.0.0/16
전략...
[addons] Applied essential addon: kube-proxy
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/
You can now join any number of the control-plane node running the following command on each as root:
"kubeadm join 192.168.4.111:16443 --token $TOKEN_VALUE \
--discovery-token-ca-cert-hash sha256:$DISCOVERY_TOKEN_CA_CERT_HASH \
--control-plane --certificate-key $CONTROL_PLANE_CERTIFICATE_KEY"
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
kubeadm init phase upload-certs --upload-certs to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.192.168:16443 --token $WORKER_JOIN_TOKEN \
--discovery-token-ca-cert-hash sha256:$WORKER_JOIN_DISCOVERY_TOKEN_CA_CERT_HASH
kubeadm join 192.168.192.168:16443 --token $TOKEN_VALUE \
--discovery-token-ca-cert-hash sha256:$DISCOVERY_TOKEN_CA_CERT_HASH \
--control-plane --certificate-key $CONTROL_PLANE_CERTIFICATE_KEY
export KUBECONFIG=/etc/kubernetes/admin.conf
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8sm01.haedongg.net Ready control-plane 62d v1.30.0
k8sm02.haedongg.net Ready control-plane 319d v1.30.0
k8sm03.haedongg.net Ready control-plane 319d v1.30.0