简体   繁体   中英

How to have an annotation only in one pod of a given deployment?

Imagine you have a Kubernetes deployment in a cluster with autoscaling capabilities.

I want to make sure that only of the pods from this deployment contains a specific annotation.

It could be for example the first running pod, and when it stops working this annotation would be replicated to a different pod.

If you really want to prevent downtime while some nodes are going down annotations is probably not the best way. You can use a combination of some of these.

  • Pod Topology Spread Constraints . For example, make sure there is always a pod running in one of the availability zones. Or on a node that never goes down.
  • Pod Disruption Budget (mentioned in the comments above). For example, make sure that you always have a minimum set of unavailable pods. For example, don't allow the cluster autoscaler to drain the node unless another pod is up somewhere else.

✌️

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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