kubernetes 在kubenetes中创建相同的主节点和工作节点

hvvq6cgz  于 2022-12-11  发布在  Kubernetes
关注(0)|答案(3)|浏览(184)

我正在准备dev环境,并希望创建一个主机作为kubernetes的主节点和工作节点。
我怎样才能实现我的目标?

a0zr77ik

a0zr77ik1#

  • 主节点和工作节点之间的区别在于“由于存在污点,无法在主节点上调度常规pod”
  • 您只需要删除node-role.kubernetes.io/master:NoSchedule污点,以便可以在该(主)节点上调度pod。

命令如下:

kubectl taint nodes <masternodename> node-role.kubernetes.io/master:NoSchedule-
b1zrtrql

b1zrtrql2#

The master node is responsible for running several Kubernetes processes that are absolutely necessary to run and manage the cluster properly. 1(https://www.educative.io/edpresso/what-is-kubernetes-cluster-what-are-worker-and-master-nodes)
The worker nodes are the part of the Kubernetes clusters which actually execute the containers and applications on them. 1(https://www.educative.io/edpresso/what-is-kubernetes-cluster-what-are-worker-and-master-nodes)

Worker nodes are generally more powerful than master nodes because they have to run hundreds of clusters on them. However, master nodes hold more significance because they manage the distribution of workload and the state of the cluster. 1(https://www.educative.io/edpresso/what-is-kubernetes-cluster-what-are-worker-and-master-nodes)

By removing taint you will be able to schedule pods on that node.
You should firstly check the present taint by running:

kubectl describe node <nodename> | grep Taints

In case the present one is master node you should remove that taint by running:

kubectl taint node <mastername> node-role.kubernetes.io/master:NoSchedule-

References: [1] - What is Kubernetes cluster? What are worker and master nodes?
See also:

  1. This four similar questions:
  2. Master tainted - no pods can be deployed
  3. Remove node-role.kubernetes.io/master:NoSchedule taint ,
  4. Allow scheduling of pods on Kubernetes master?
  5. Are the master and worker nodes the same node in case of a single node cluster?
  6. Taints and Tolerations .
rjee0c15

rjee0c153#

kubectl describe node sydney | grep Taints
Taints:             node-role.kubernetes.io/control-plane:NoSchedule

kubectl taint nodes sydney node-role.kubernetes.io/control-plane:NoSchedule-
node/sydney untainted

kubectl describe node sydney | grep Taints
Taints:             <none>

相关问题