ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
Label 用来定义`key/value`键值对资源,一个 Label 就是一个`key/value`键值对,其中 key 和 value 由用户自己指定。 <br/> Label 最常见的用法是使用 `metadata.labels` 字段,来为对象添加 Label,通过 `spec.selector` 来引用对象。 ```yaml apiVersion: v1 kind: ReplicationController metadata: name: nginx spec: replicas: 3 selector: app: nginx #引用app/nginx的label template: metadata: labels: app: nginx #定义key/value为:app/nginx 的label资源 spec: containers: - name: nginx image: nginx ports: - containerPort: 80 ```