$ oc edit networks.operator.openshift.io cluster
作为集群管理员,您可以修改现有附加网络的配置。
作为集群管理员,您可以对现有附加网络进行更改。连接到附加网络的任何现有 Pod 不会更新。
您已为集群配置了附加网络。
安装 OpenShift 命令行界面 (oc
)。
以具有 cluster-admin
权限的用户身份登录。
要编辑集群的附加网络,请完成以下步骤:
运行以下命令以在默认文本编辑器中编辑集群网络操作员 (CNO) CR:
$ oc edit networks.operator.openshift.io cluster
在 additionalNetworks
集合中,使用您的更改更新附加网络。
保存更改并退出文本编辑器以提交更改。
可选:通过运行以下命令确认 CNO 是否更新了 NetworkAttachmentDefinition
对象。将 <network-name>
替换为要显示的附加网络的名称。CNO 更新 NetworkAttachmentDefinition
对象以反映您的更改可能需要一些时间。
$ oc get network-attachment-definitions <network-name> -o yaml
例如,以下控制台输出显示名为 net1
的 NetworkAttachmentDefinition
对象:
$ oc get network-attachment-definitions net1 -o go-template='{{printf "%s\n" .spec.config}}'
{ "cniVersion": "0.3.1", "type": "macvlan",
"master": "ens5",
"mode": "bridge",
"ipam": {"type":"static","routes":[{"dst":"0.0.0.0/0","gw":"10.128.2.1"}],"addresses":[{"address":"10.128.2.100/23","gateway":"10.128.2.1"}],"dns":{"nameservers":["172.30.0.10"],"domain":"us-west-2.compute.internal","search":["us-west-2.compute.internal"]}} }