Kubernetes : Control Plane नोड जोड़ें2024/06/07 |
मौजूदा Kubernetes क्लस्टर में नए Control Plane नोड्स जोड़ें।
यह उदाहरण क्लस्टर वातावरण पर आधारित है, जो इस प्रकार है।
*टिप्पणी +----------------------+ +----------------------+ | [ ctrl.srv.world ] | | [ dlp.srv.world ] | | Manager Node | | Control Plane | +-----------+----------+ +-----------+----------+ eth0|10.0.0.25 eth0|10.0.0.30 | | ------------+--------------------------+----------- | | eth0|10.0.0.51 eth0|10.0.0.52 +-----------+----------+ +-----------+----------+ | [ node01.srv.world ] | | [ node02.srv.world ] | | Worker Node#1 | | Worker Node#2 | +----------------------+ +----------------------+ |
[1] |
एक नए नोड पर, क्लस्टर में शामिल होने के लिए सामान्य सेटिंग्स कॉन्फ़िगर करें, यहां देखें। |
[2] | प्रबंधक नोड पर नए Control Plane के लिए प्रॉक्सी सेटिंग जोड़ें। |
root@ctrl:~#
vi /etc/nginx/nginx.conf # नया Control Plane जोड़ें stream { upstream k8s-api { server 10.0.0.30:6443; server 10.0.0.31:6443; } server { listen 6443; proxy_pass k8s-api; } }root@ctrl:~# systemctl reload nginx
|
[3] | मौजूदा Control Plane नोड पर जॉइन कमांड की पुष्टि करें और किसी भी उपयोगकर्ता के साथ प्रमाणपत्र फ़ाइलों को नए नोड में स्थानांतरित करें। |
root@dlp:~#
root@dlp:/etc/kubernetes/pki# cd /etc/kubernetes/pki root@dlp:/etc/kubernetes/pki# tar czvf kube-certs.tar.gz sa.pub sa.key ca.crt ca.key front-proxy-ca.crt front-proxy-ca.key etcd/ca.crt etcd/ca.key root@dlp:/etc/kubernetes/pki# scp kube-certs.tar.gz ubuntu@10.0.0.31:/tmp
kubeadm token create --print-join-command kubeadm join 10.0.0.25:6443 --token h8bpe5.ank6u1ui211x4e5z --discovery-token-ca-cert-hash sha256:9cb21e3807780e1acf9ad9b6369ce54b1141ecf007d099675b23b6c3368494c9 |
[4] | [--control-plane] विकल्प के साथ नए नोड पर आपके द्वारा पुष्टि की गई join कमांड चलाएँ। |
# मौजूदा Control Plane से स्थानांतरित प्रमाणपत्रों की प्रतिलिपि बनाएँ root@dlp-1:~# mkdir /etc/kubernetes/pki root@dlp-1:~# tar zxvf /tmp/kube-certs.tar.gz -C /etc/kubernetes/pki
kubeadm join 10.0.0.25:6443 --token h8bpe5.ank6u1ui211x4e5z \ --discovery-token-ca-cert-hash sha256:9cb21e3807780e1acf9ad9b6369ce54b1141ecf007d099675b23b6c3368494c9 \ --control-plane [preflight] Running pre-flight checks [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' [preflight] Running pre-flight checks before initializing the new control plane instance [preflight] Pulling images required for setting up a Kubernetes cluster [preflight] This might take a minute or two, depending on the speed of your internet connection [preflight] You can also perform this action in beforehand using 'kubeadm config images pull' ..... ..... This node has joined the cluster and a new control plane instance was created: * Certificate signing request was sent to apiserver and approval was received. * The Kubelet was informed of the new secure connection details. * Control plane label and taint were applied to the new node. * The Kubernetes control plane instances scaled up. * A new etcd member was added to the local/stacked etcd cluster. To start administering your cluster from this node, 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 Run 'kubectl get nodes' to see this node join the cluster. |
[5] | प्रबंधक नोड पर सेटिंग्स सत्यापित करें। यदि नए नोड की स्थिति [स्थिति = तैयार] हो जाती है तो यह ठीक है। |
root@ctrl:~# kubectl get nodes NAME STATUS ROLES AGE VERSION dlp-1.srv.world Ready control-plane 67s v1.30.1 dlp.srv.world Ready control-plane 143m v1.30.1 node01.srv.world Ready <none> 138m v1.30.1 node02.srv.world Ready <none> 137m v1.30.1root@ctrl:~# kubectl get pods -A -o wide | grep dlp-1 kube-system calico-node-7sqz9 1/1 Running 0 112s 10.0.0.31 dlp-1.srv.world <none> <none> kube-system etcd-dlp-1.srv.world 1/1 Running 0 110s 10.0.0.31 dlp-1.srv.world <none> <none> kube-system kube-apiserver-dlp-1.srv.world 1/1 Running 0 110s 10.0.0.31 dlp-1.srv.world <none> <none> kube-system kube-controller-manager-dlp-1.srv.world 1/1 Running 0 110s 10.0.0.31 dlp-1.srv.world <none> <none> kube-system kube-proxy-6bf8b 1/1 Running 0 112s 10.0.0.31 dlp-1.srv.world <none> <none> kube-system kube-scheduler-dlp-1.srv.world 1/1 Running 0 110s 10.0.0.31 dlp-1.srv.world <none> <none> |
Sponsored Link |
|