Why labels are mentioned three times in a single deployment

后端 未结 3 1192
清歌不尽
清歌不尽 2021-01-12 13:59

I\'ve gone over the following docomentation page: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

The example deployment yaml is as follows:

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-12 14:32

    First label:

    It is deployment label which is used to select deployment. You can use below command using first label:

    kubectl get deployment -l app=nginx
    

    Second Label:

    It is not a label . It is label selector to select pod with labels nginx. It is used by ReplicaSet.

    Third Label:

    It is pod label to identify pods. It is used by ReplicaSet to maintain desired num of replica and for that label selector is used. Also it is used to selects pod with below command:

    kubectl get pods -l app=nginx
    

提交回复
热议问题