Kubernetes : नियंत्रण विमान नोड कॉन्फ़िगर करें2023/11/16 |
मल्टी नोड्स Kubernetes क्लस्टर को कॉन्फ़िगर करने के लिए Kubeadm स्थापित करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
-----------+---------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.51 eth0|10.0.0.52 +----------+-----------+ +-----------+----------+ +-----------+----------+ | [ dlp.srv.world ] | | [ node01.srv.world ] | | [ node02.srv.world ] | | Control Plane | | Worker Node | | Worker Node | +----------------------+ +----------------------+ +----------------------+ |
[1] |
[2] |
कंट्रोल प्लेन नोड पर प्रारंभिक सेटअप कॉन्फ़िगर करें।
[control-plane-endpoint] के लिए, होस्टनाम या IP पता निर्दिष्ट करें जिस पर Etcd और Kubernetes API सर्वर चलाए जाते हैं।
[--pod-network-cidr] विकल्प के लिए, वह नेटवर्क निर्दिष्ट करें जिसका उपयोग Pod नेटवर्क करता है।
पॉड नेटवर्क के लिए कुछ प्लगइन्स हैं। (नीचे विवरण देखें)
⇒ https://kubernetes.io/docs/concepts/cluster-administration/networking/
इस उदाहरण पर, यह Calico का चयन करता है।
|
[root@dlp ~]# kubeadm init --control-plane-endpoint=10.0.0.30 --pod-network-cidr=192.168.0.0/16 --cri-socket=unix:///var/run/crio/crio.sock [init] Using Kubernetes version: v1.27.8 [preflight] Running pre-flight checks [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' [certs] Using certificateDir folder "/etc/kubernetes/pki" [certs] Generating "ca" certificate and key [certs] Generating "apiserver" certificate and key [certs] apiserver serving cert is signed for DNS names [dlp.srv.world kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 10.0.0.30] [certs] Generating "apiserver-kubelet-client" certificate and key ..... ..... 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 control-plane nodes by copying certificate authorities and service account keys on each node and then running the following as root: kubeadm join 10.0.0.30:6443 --token kp5yik.noqvh58p8d0vtmnw \ --discovery-token-ca-cert-hash sha256:9fb2f2d15822a8f48b03fd9b3a6cbfe82741bde274b4450b53e5b2435bfc47a3 \ --control-plane Then you can join any number of worker nodes by running the following on each as root: kubeadm join 10.0.0.30:6443 --token kp5yik.noqvh58p8d0vtmnw \ --discovery-token-ca-cert-hash sha256:9fb2f2d15822a8f48b03fd9b3a6cbfe82741bde274b4450b53e5b2435bfc47a3 # क्लस्टर व्यवस्थापक उपयोगकर्ता सेट करें # यदि आप सामान्य उपयोगकर्ता को क्लस्टर व्यवस्थापक के रूप में सेट करते हैं, तो इसके साथ लॉगिन करें और [sudo cp/chown ***] चलाएँ [root@dlp ~]# mkdir -p $HOME/.kube [root@dlp ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config [root@dlp ~]# chown $(id -u):$(id -g) $HOME/.kube/config
|
[3] | Calico के साथ पॉड नेटवर्क कॉन्फ़िगर करें। |
[root@dlp ~]# wget https://raw.githubusercontent.com/projectcalico/calico/master/manifests/calico.yaml [root@dlp ~]# kubectl apply -f calico.yaml poddisruptionbudget.policy/calico-kube-controllers created serviceaccount/calico-kube-controllers created serviceaccount/calico-node created serviceaccount/calico-cni-plugin created configmap/calico-config created customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/bgpfilters.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/caliconodestatuses.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipreservations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created clusterrole.rbac.authorization.k8s.io/calico-node created clusterrole.rbac.authorization.k8s.io/calico-cni-plugin created clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created clusterrolebinding.rbac.authorization.k8s.io/calico-node created clusterrolebinding.rbac.authorization.k8s.io/calico-cni-plugin created daemonset.apps/calico-node created deployment.apps/calico-kube-controllers created # स्थिति दिखाओ : ठीक है अगर STATUS = Ready [root@dlp ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION dlp.srv.world Ready control-plane 3m12s v1.27.7 # स्थिति दिखाएँ : ठीक है यदि सभी चल रहे हैं [root@dlp ~]# kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system calico-kube-controllers-8787c9999-7q7rp 1/1 Running 0 37s kube-system calico-node-p4wfn 0/1 Running 0 37s kube-system coredns-5d78c9869d-278jf 1/1 Running 0 3m11s kube-system coredns-5d78c9869d-kbrlh 1/1 Running 0 3m11s kube-system etcd-dlp.srv.world 1/1 Running 0 3m26s kube-system kube-apiserver-dlp.srv.world 1/1 Running 0 3m25s kube-system kube-controller-manager-dlp.srv.world 1/1 Running 0 3m24s kube-system kube-proxy-qr2c2 1/1 Running 0 3m12s kube-system kube-scheduler-dlp.srv.world 1/1 Running 0 3m23s |
Sponsored Link |
|