What is the purpose of a kubernetes deployment pod selector?

后端 未结 3 813
南笙
南笙 2020-12-05 17:21

I fail to see why kubernetes need a pod selector in a deployment statement that can only contain one pod template? Feel free to educate me why kubernetes engineers introduce

3条回答
  •  佛祖请我去吃肉
    2020-12-05 17:49

    However, if you don’t, you can run into problems with kubectl apply once one or more of the labels that are used for selecting change because kubeclt apply will look at kubectl.kubernetes.io/last-applied-configuration when comparing changes and that annotation will only contain the user input when he created the resource and none of the defaulted fields.

    Quoting from Toon's answer.

    My interpretation is it's not logically necessary at all. It's only due to the limitation of the current implementation of Kubernetes, that it has some weird "behavior" in that the functionality it uses to "compare" two deployments / objects does not take into account "default values".

提交回复
热议问题