简体   繁体   English

kubernetes daemonset 如何工作?

[英]How kubernetes daemonset works?

I have a doubt, hope you would help.我有疑问,希望能帮到你。

Suppose I have 4 node and created a deployment with ReplicaSet value is 3 with pod spec having label xyz.假设我有 4 个节点并创建了一个 ReplicaSet 值为 3 的部署,pod 规范具有标签 xyz。 Now creating one DaemonSet with pod having label xyz which is same mentioned above.现在创建一个带有标签 xyz 的 Pod 的 DaemonSet,这与上面提到的相同。 Now finally how many pods will be there 4 or 3 and how does it work?现在最终会有多少个豆荚 4 或 3 个,它是如何工作的?

Please reply soon.请尽快回复。

Total pods would be 7, 3 created by deployment, and 4 would be created by DamemonSet on each node. Pod 总数为 7 个,其中 3 个由部署创建,4 个由 DamemonSet 在每个节点上创建。

A DaemonSet deploys pods to all nodes in the cluster. DaemonSet 将 pod 部署到集群中的所有节点。

As per Kubernetes docs :-根据Kubernetes 文档:-

you should not normally create any pods whose labels match this selector, either directly, with another ReplicationController, or with another controller such as Job.您通常不应该直接创建任何标签与此选择器匹配的 pod,或者直接使用另一个 ReplicationController,或者使用另一个控制器(例如 Job)。 If you do so, the ReplicationController thinks that it created the other pods.如果这样做,ReplicationController 会认为它创建了其他 pod。 Kubernetes does not stop you from doing this. Kubernetes 不会阻止您这样做。

If you do end up with multiple controllers that have overlapping selectors, you will have to manage the deletion yourself如果您最终得到多个具有重叠选择器的控制器,则必须自己管理删除

Well it will be 7 pods in total because deployment and daemonsets are complete different terms.好吧,总共将有 7 个 pod,因为部署和守护进程集是完全不同的术语。 In real world Deployment mainly used for deploying business related applications which serve request coming from end user.在现实世界中,Deployment 主要用于部署服务于来自最终用户的请求的业务相关应用程序。 On the other hand daemonsets runs on each node the use case of daemonsets would be collecting logs from different worker nodes.另一方面,daemonsets 在每个节点上运行,daemonsets 的用例将收集来自不同工作节点的日志。 And it's the right purpose.这是正确的目的。 No matter what if you add new node to your Kubernetes cluster daemonsets will spin up the pod on that new node also.无论如何,如果您向 Kubernetes 集群中添加新节点,守护进程集也会在该新节点上启动 pod。 I hope you got the clear understanding the use of deployment and daemonsets我希望你对部署和守护进程的使用有一个清晰的了解

In nutshell简而言之

Deployment: Host business related application部署:托管业务相关应用

Daemonsets: Used in monitoring cluster and gathering logs from different worker nodes Daemonsets:用于监控集群和从不同的工作节点收集日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM