6.2. OpenShift CLI(oc)开发人员命令
您可以使用 oc 命令行工具管理应用程序并与 MicroShift 集群交互。使用以下命令及其描述和示例用法与集群资源配合。
6.2.1. oc annotate 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
更新资源上的注解
用法示例
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'
# If the same annotation is set multiple times, only the last value will be applied
oc annotate pods foo description='my frontend'
# Update a pod identified by type and name in "pod.json"
oc annotate -f pod.json description='my frontend'
# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value
oc annotate --overwrite pods foo description='my frontend running nginx'
# Update all pods in the namespace
oc annotate pods --all description='my frontend running nginx'
# Update pod 'foo' only if the resource is unchanged from version 1
oc annotate pods foo description='my frontend running nginx' --resource-version=1
# Update pod 'foo' by removing an annotation named 'description' if it exists
# Does not require the --overwrite flag
oc annotate pods foo description-