@@ -3,12 +3,24 @@ title: 众所周知的标签、注解和污点
3
3
content_type : concept
4
4
weight : 40
5
5
no_list : true
6
+ card :
7
+ name : reference
8
+ weight : 30
9
+ anchors :
10
+ - anchor : " #labels-annotations-and-taints-used-on-api-objects"
11
+ title : 标签、注解和污点
6
12
---
7
13
<!--
8
14
title: Well-Known Labels, Annotations and Taints
9
15
content_type: concept
10
16
weight: 40
11
17
no_list: true
18
+ card:
19
+ name: reference
20
+ weight: 30
21
+ anchors:
22
+ - anchor: "#labels-annotations-and-taints-used-on-api-objects"
23
+ title: Labels, annotations and taints
12
24
-->
13
25
14
26
<!-- overview -->
@@ -25,7 +37,36 @@ Kubernetes 将所有标签和注解保留在 `kubernetes.io` 和 `k8s.io `名字
25
37
26
38
<!--
27
39
## Labels, annotations and taints used on API objects
40
+ -->
41
+ ## API 对象上使用的标签、注解和污点 {#labels-annotations-and-taints-used-on-api-objects}
42
+
43
+ ### apf.kubernetes.io/autoupdate-spec
44
+
45
+ <!--
46
+ Type: Annotation
47
+
48
+ Example: `apf.kubernetes.io/autoupdate-spec: "true"`
49
+
50
+ Used on: [`FlowSchema` and `PriorityLevelConfiguration` Objects](/concepts/cluster-administration/flow-control/#defaults)
51
+
52
+ If this annotation is set to true on a FlowSchema or PriorityLevelConfiguration, the `spec` for that object
53
+ is managed by the kube-apiserver. If the API server does not recognize an APF object, and you annotate it
54
+ for automatic update, the API server deletes the entire object. Otherwise, the API server does not manage the
55
+ object spec.
56
+ For more details, read [Maintenance of the Mandatory and Suggested Configuration Objects](/docs/concepts/cluster-administration/flow-control/#maintenance-of-the-mandatory-and-suggested-configuration-objects).
57
+ -->
58
+ 类别:注解
28
59
60
+ 例子:` apf.kubernetes.io/autoupdate-spec: "true" `
61
+
62
+ 用于:[ ` FlowSchema ` 和 ` PriorityLevelConfiguration ` 对象] ( /zh-cn/concepts/cluster-administration/flow-control/#defaults )
63
+
64
+ 如果在 FlowSchema 或 PriorityLevelConfiguration 上将此注解设置为 true,
65
+ 那么该对象的 ` spec ` 将由 kube-apiserver 进行管理。如果 API 服务器不识别 APF 对象,
66
+ 并且你对其添加了自动更新的注解,则 API 服务器将删除整个对象。否则,API 服务器不管理对象规约。
67
+ 更多细节参阅[ 维护强制性和建议的配置对象] ( /zh-cn/docs/concepts/cluster-administration/flow-control/#maintenance-of-the-mandatory-and-suggested-configuration-objects )
68
+
69
+ <!--
29
70
### app.kubernetes.io/component
30
71
31
72
Type: Label
@@ -38,8 +79,6 @@ The component within the application architecture.
38
79
39
80
One of the [recommended labels](/docs/concepts/overview/working-with-objects/common-labels/#labels).
40
81
-->
41
- ## API 对象上使用的标签、注解和污点 {#labels-annotations-and-taints-used-on-api-objects}
42
-
43
82
### app.kubernetes.io/component {#app-kubernetes-io-component}
44
83
45
84
类别:标签
@@ -449,6 +488,36 @@ The value must be in the format `<toolname>/<semver>`.
449
488
工具应该拒绝改变属于其他工具 ApplySets。
450
489
该值必须采用 ` <toolname>/<semver> ` 格式。
451
490
491
+ ### apps.kubernetes.io/pod-index (beta) {#apps-kubernetes.io-pod-index}
492
+
493
+ <!--
494
+ Type: Label
495
+
496
+ Example: `apps.kubernetes.io/pod-index: "0"`
497
+
498
+ Used on: Pod
499
+
500
+ When a StatefulSet controller creates a Pod for the StatefulSet, it sets this label on that Pod.
501
+ The value of the label is the ordinal index of the pod being created.
502
+
503
+ See [Pod Index Label](/docs/concepts/workloads/controllers/statefulset/#pod-index-label)
504
+ in the StatefulSet topic for more details. Note the [PodIndexLabel](content/en/docs/reference/command-line-tools-reference/feature-gates.md) feature gate must be enabled
505
+ for this label to be added to pods.
506
+ -->
507
+ 类别:标签
508
+
509
+ 例子:` apps.kubernetes.io/pod-index: "0" `
510
+
511
+ 用于:Pod
512
+
513
+ 当 StatefulSet 控制器为 StatefulSet 创建 Pod 时,该控制器会在 Pod 上设置这个标签。
514
+ 标签的值是正在创建的 Pod 的序号索引。
515
+
516
+ 更多细节参阅 StatefulSet 主题中的
517
+ [ Pod 索引标签] ( /zh-cn/docs/concepts/workloads/controllers/statefulset/#pod-index-label ) 。
518
+ 请注意,[ PodIndexLabel] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates.md ) 特性门控必须被启用,
519
+ 才能将此标签添加到 Pod 上。
520
+
452
521
<!--
453
522
### cluster-autoscaler.kubernetes.io/safe-to-evict
454
523
@@ -1723,6 +1792,45 @@ The control plane adds this label to an Endpoints object when the owning Service
1723
1792
1724
1793
当拥有的 Service 是无头类型时,控制平面将此标签添加到 Endpoints 对象。
1725
1794
1795
+ <!--
1796
+ ### service.kubernetes.io/topology-aware-hints (deprecated) {#servicekubernetesiotopology-aware-hints}
1797
+
1798
+ Example: `service.kubernetes.io/topology-aware-hints: "Auto"`
1799
+
1800
+ Used on: Service
1801
+ -->
1802
+ ### service.kubernetes.io/topology-aware-hints(已弃用) {#servicekubernetesiotopology-aware-hints}
1803
+
1804
+ 例子:` service.kubernetes.io/topology-aware-hints: "Auto" `
1805
+
1806
+ 用于:Service
1807
+
1808
+ <!--
1809
+ This annotation was used for enabling _topology aware hints_ on Services. Topology aware
1810
+ hints have since been renamed: the concept is now called
1811
+ [topology aware routing](/docs/concepts/services-networking/topology-aware-routing/).
1812
+ Setting the annotation to `Auto`, on a Service, configured the Kubernetes control plane to
1813
+ add topology hints on EndpointSlices associated with that Service. You can also explicitly
1814
+ set the annotation to `Disabled`.
1815
+
1816
+ If you are running a version of Kubernetes older than {{< skew currentVersion >}},
1817
+ check the documentation for that Kubernetes version to see how topology aware routing
1818
+ works in that release.
1819
+
1820
+ There are no other valid values for this annotation. If you don't want topology aware hints
1821
+ for a Service, don't add this annotation.
1822
+ -->
1823
+ 此注解曾用于在 Service 中启用** 拓扑感知提示(topology aware hints)** 。
1824
+ 然而,拓扑感知提示已经做了更名操作,
1825
+ 此概念现在名为[ 拓扑感知路由(topology aware routing)] ( /zh-cn/docs/concepts/services-networking/topology-aware-routing/ ) 。
1826
+ 在 Service 上将该注解设置为 ` Auto ` 会配置 Kubernetes 控制平面,
1827
+ 以将拓扑提示添加到该 Service 关联的 EndpointSlice 上。你也可以显式地将该注解设置为 ` Disabled ` 。
1828
+
1829
+ 如果你使用的是早于 {{< skew currentVersion >}} 的 Kubernetes 版本,
1830
+ 请查阅该版本对应的文档,了解其拓扑感知路由的工作方式。
1831
+
1832
+ 此注解没有其他有效值。如果你不希望为 Service 启用拓扑感知提示,不要添加此注解。
1833
+
1726
1834
<!--
1727
1835
### kubernetes.io/service-name {#kubernetesioservice-name}
1728
1836
@@ -2029,26 +2137,57 @@ kubelet 会在 Node 上设置此注解以表示从命令行标志(`--node-ip`
2029
2137
<!--
2030
2138
### batch.kubernetes.io/job-completion-index
2031
2139
2032
- Type: Annotation
2140
+ Type: Annotation, Label
2033
2141
2034
2142
Example: `batch.kubernetes.io/job-completion-index: "3"`
2035
2143
2036
2144
Used on: Pod
2037
2145
2038
- The Job controller in the kube-controller-manager sets this annotation for Pods
2146
+ The Job controller in the kube-controller-manager sets this as a label and annotation for Pods
2039
2147
created with Indexed [completion mode](/docs/concepts/workloads/controllers/job/#completion-mode).
2040
2148
-->
2041
2149
### batch.kubernetes.io/job-completion-index {#batch-kubernetes-io-job-completion-index}
2042
2150
2043
- 类别:注解
2151
+ 类别:注解、标签
2044
2152
2045
2153
例子:` batch.kubernetes.io/job-completion-index: "3" `
2046
2154
2047
2155
用于:Pod
2048
2156
2049
2157
kube-controller-manager 中的 Job 控制器为使用 Indexed
2050
2158
[ 完成模式] ( /zh-cn/docs/concepts/workloads/controllers/job/#completion-mode ) 创建的 Pod
2051
- 设置此注解。
2159
+ 设置此标签和注解。
2160
+
2161
+ <!--
2162
+ Note the [PodIndexLabel](content/en/docs/reference/command-line-tools-reference/feature-gates.md) feature gate must be enabled
2163
+ for this to be added as a pod **label**, otherwise it will just be an annotation.
2164
+ -->
2165
+ 请注意,[ PodIndexLabel] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates.md ) 特性门控必须被启用,
2166
+ 才能将其添加为 Pod 的** 标签** ,否则它只会用作注解。
2167
+
2168
+ ### batch.kubernetes.io/cronjob-scheduled-timestamp
2169
+
2170
+ <!--
2171
+ Type: Annotation
2172
+
2173
+ Example: `batch.kubernetes.io/cronjob-scheduled-timestamp: "2016-05-19T03:00:00-07:00"`
2174
+
2175
+ Used on: Jobs and Pods controlled by CronJobs
2176
+
2177
+ This annotation is used to record the original (expected) creation timestamp for a Job,
2178
+ when that Job is part of a CronJob.
2179
+ The control plane sets the value to that timestamp in RFC3339 format. If the Job belongs to a CronJob
2180
+ with a timezone specified, then the timestamp is in that timezone. Otherwise, the timestamp is in controller-manager's local time.
2181
+ -->
2182
+ 类别:注解
2183
+
2184
+ 例子:` batch.kubernetes.io/cronjob-scheduled-timestamp: "2016-05-19T03:00:00-07:00" `
2185
+
2186
+ 用于:CronJob 所控制的 Job 和 Pod
2187
+
2188
+ 此注解在 Job 是 CronJob 的一部分时用于记录 Job 的原始(预期)创建时间戳。
2189
+ 控制平面会将该值设置为 RFC3339 格式的时间戳。如果 Job 属于设置了时区的 CronJob,
2190
+ 则时间戳以该时区为基准。否则,时间戳以 controller-manager 的本地时间为准。
2052
2191
2053
2192
<!--
2054
2193
### kubectl.kubernetes.io/default-container
@@ -2101,6 +2240,34 @@ annotation instead. Kubernetes versions 1.25 and newer ignore this annotation.
2101
2240
Kubernetes v1.25 及更高版本将忽略此注解。
2102
2241
{{< /note >}}
2103
2242
2243
+ ### kubectl.kubernetes.io/last-applied-configuration
2244
+
2245
+ <!--
2246
+ Type: Annotation
2247
+
2248
+ Example: _see following snippet_
2249
+ -->
2250
+ 类别:注解
2251
+
2252
+ 例子:** 参见以下代码片段**
2253
+
2254
+ ``` yaml
2255
+ kubectl.kubernetes.io/last-applied-configuration : >
2256
+ {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"example","namespace":"default"},"spec":{"selector":{"matchLabels":{"app.kubernetes.io/name":foo}},"template":{"metadata":{"labels":{"app.kubernetes.io/name":"foo"}},"spec":{"containers":[{"image":"container-registry.example/foo-bar:1.42","name":"foo-bar","ports":[{"containerPort":42}]}]}}}}
2257
+ ` ` `
2258
+
2259
+ <!--
2260
+ Used on: all objects
2261
+
2262
+ The kubectl command line tool uses this annotation as a legacy mechanism
2263
+ to track changes. That mechanism has been superseded by
2264
+ [Server-side apply](/docs/reference/using-api/server-side-apply/).
2265
+ -->
2266
+ 用于:所有对象
2267
+
2268
+ kubectl 命令行工具使用此注解作为一种旧的机制来跟踪变更。
2269
+ 该机制已被[服务器端应用](/zh-cn/docs/reference/using-api/server-side-apply/)取代。
2270
+
2104
2271
<!--
2105
2272
### endpoints.kubernetes.io/over-capacity
2106
2273
0 commit comments