4.4.2 管理资源注解

annotations 可再资源创建时使用 “metadata.annotations” 字段指定,也可随时按需在活动的资源上使用 “kubectl annotate” 命令行进行附加。例如,为 pod-example 重新进行注解:

**[terminal]
**[delimiter $ ]**[command kubectl annotate pods pod-example ilinux.io/created-by="cluster admin"]
pod/pod-example annotated

查看生成的注释信息:

**[terminal]
**[delimiter $ ]**[command kubectl describe pods pod-example | grep "Annotations"]
Annotations:        ilinux.io/created-by: cluster admin

如果需要在资源创建时的清单中指定,那么使用类似如下的方式即可:

apiVersion: v1
kind: Pod
metadata:
    name: pod-example
    annotations:
        ilinux.io/created-by: cluster admin
spec:
... 省略 ...

results matching ""

    No results matching ""