Kubernetes 标签

节点标签#

  • kubernetes.io/ingress.class
labeldemodesc
k3s.io/hostnamenode-3
k3s.io/internal-ip10.10.1.1
kubernetes.io/archamd64+v1.14
kubernetes.io/hostnamenode-3
kubernetes.io/oslinux+v1.14
node-role.kubernetes.io/<role>true
node-role.kubernetes.io/mastertrueMaster node
node.kubernetes.io/instance-typek3s
topology.kubernetes.io/region+v1.17
topology.kubernetes.io/zone+v1.17
# 设置 node role 为 worker
# role 名字任意
# value 不重要,主要是存在该 label
kubectl label node-2 node-role.kubernetes.io/worker=true

Deprecated#

labeldemodesc
beta.kubernetes.io/archamd64!v1.14, -v1.18
beta.kubernetes.io/instance-typek3s!v1.17
beta.kubernetes.io/oslinux!v1.14, -v1.18
failure-domain.beta.kubernetes.io/region!v1.17
failure-domain.beta.kubernetes.io/zone!v1.17

资源标签#

kindannotationdemodesc
StorageClassstorageclass.kubernetes.io/is-default-classtrue默认 StorageClass

应用标签#

labelexample
app.kubernetes.io/namemysql
app.kubernetes.io/instancemysql-abcd
app.kubernetes.io/version5.7
app.kubernetes.io/componentdatabase
app.kubernetes.io/part-ofghost
app.kubernetes.io/managed-byhelm
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/component: prometheus
app.kubernetes.io/instance: kube-prometheus
app.kubernetes.io/name: kube-prometheus
topologyKey: kubernetes.io/hostname

Helm 标签#

labelexample
app.kubernetes.io/managed-byHelm
# 资源 label
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/version: 0.35.0
helm.sh/chart: ingress-nginx-2.16.0
# selector label
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx

Helm 注解#

annotationvaluedesc
meta.helm.sh/release-namelinkerd2
meta.helm.sh/release-namespacelinkerd