Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use label to control the position of Pod

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use label to control the location of Pod, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

By default, Scheduler dispatches Pod to all available Node. However, there are some situations where we want to deploy Pod to a specified Node, such as deploying a Pod with a large number of disk Iripple O to a Node; configured with SSD or Pod requiring GPU, which needs to run on a node configured with GPU.

Kubernetes implements this function through label.

Label is a key-value pair. Label can be set for all kinds of resources, and various custom attributes can be added flexibly. For example, execute the following command to mark that k8s-node1 is a node configured with SSD.

Kubectl label node k8s-node1 disktype=ssd

Then view the node's label through kubectl get node-- show-labels.

Disktype=ssd has been successfully added to k8s-node1, and there are several label maintained by Kubernetes itself in addition to disktype,Node.

With the custom label of disktype, you can then specify that Pod be deployed to k8s-node1. Edit nginx.yml:

All 6 copies run on k8s-node1, in line with our expectations.

To delete the label disktype, execute the following command:

Kubectl label node k8s-node1 disktype-

-that is, delete.

Unless you delete the nodeSelector setting in nginx.yml and then redeploy via kubectl apply.

Kubernetes deletes the previous Pod and schedules and runs the new Pod.

This is the end of the discussion on Deployment operations.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report