In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how kubernetes assigns the container to some nodes to run". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how kubernetes assigns the container to run on certain nodes.
Assume that the deployed kubernetes cluster has five nodes, one master node and four work nodes, the default master node does not schedule Pod, and all Pod dispatch Pod on four work nodes. The simple list is as follows:
Hostname
Role
Node1
Masternode2
Worknode3worknode4worknode5work
Now you need to deploy 2 container applications An and B, where A belongs to business applications (such as springboot web applications) and B belongs to components (such as redis, zookeeper, etc.). You need to assign An applications to node2 and node3 nodes, and application B to node4 and node5 nodes to isolate components from business applications. The specific implementation is as follows:
1. View the label information of the current cluster node:
# View the current cluster node tag information kubectl get nodes-show-labels
# you can see that the default initial label for each node is roughly as follows: beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=node2,kubernetes.io/os=linux
2. Mark node2 and node3 nodes as business applications and node4 and node5 as component applications through deployment type tags:
Kubectl label nodes node2 deploy.type=biz_appkubectl label nodes node3 deploy.type=biz_appkubectl label nodes node4 deploy.type=assembly_appkubectl label nodes node5 deploy.type=assembly_app# confirms whether the tag is valid kubectl get nodes-- show-labels
3. Then Pod specifies the configuration as follows:
ApiVersion: apps/v1kind: Podmetadata: name: nginx-pod namespace: my-namespace labels: app: nginx-podspec: nodeSelector: deploy.type: assembly_app restartPolicy: Always containers:-name: nginx image: "nginx" ports:-containerPort: 80 so far, I believe you have a better understanding of "how kubernetes assigns the container to certain nodes to run". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.