Openshift 3.11版本

Openshift SDN网络插件ovs-subnet 与 ovs-multitenant切换

  1. 更改节点上的networkPluginName的配置
  • master节点:/etc/origin/master/master-config.yaml
  • node节点:/etc/origin/node/node-config.yaml
  • 将networkPluginName中的redhat/openshift-ovs-subnet换成redhat/openshift-ovs-multitenant,或者反过来。
    1
    2
    $ ansible all -m shell -a 'sed -i "s/openshift-ovs-subnet/openshift-ovs-multitenant/g" /etc/origin/node/node-config.yaml'
    $ ansible masters -m shell -a 'sed -i "s/openshift-ovs-subnet/openshift-ovs-multitenant/g" /etc/origin/master/master-config.yaml'
    1. 重启master节点上的origin-master-api和origin-master-controllers服务
    1
    2
    $ ansible masters -m shell -a 'master-restart api' -f 1
    $ ansible masters -m shell -a 'master-restart controllers' -f 1
    1. 停止节点上的origin-node服务
    1
    $ ansible all -m service -a 'name=origin-node state=stopped'
    1. 在所有节点上重启Openshift SDN服务
    1
    $ oc delete pod --all -n openshift-sdn
    1. 在所有节点上重启origin-node服务
    1
    $ ansible all -m service -a 'name=origin-node state=started'
    1. 如果是从openshift sdn插件切换到第三方插件,需要清空将openshit sdn的特性
    1
    2
    3
    $ oc delete clusternetwork --all
    $ oc delete hostsubnets --all
    $ oc delete netnamespaces --all
    1. 检查VNIDs
    1
    $ oc get netnamespace

Openshift SDN网络插件ovs-multitenant 切换到 ovs-networkpolicy

  1. 下载切换脚本并更改执行权限
1
2
$ curl -O https://raw.githubusercontent.com/openshift/origin/master/contrib/migration/migrate-network-policy.sh
$ chmod a+x migrate-network-policy.sh
  1. 执行脚本,openshift使用cluster-admin权限的用户
1
$ ./migrate-network-policy.sh

Openshift 3.9版本

Openshift SDN网络插件ovs-subnet 与 ovs-multitenant切换

  1. 更改节点上的networkPluginName的配置
  • master节点:/etc/origin/master/master-config.yaml
  • node节点:/etc/origin/node/node-config.yaml
  • 将networkPluginName中的redhat/openshift-ovs-subnet换成redhat/openshift-ovs-multitenant,或者反过来。
    1
    2
    $ ansible all -m shell -a 'sed -i "s/openshift-ovs-subnet/openshift-ovs-multitenant/g" /etc/origin/node/node-config.yaml'
    $ ansible masters -m shell -a 'sed -i "s/openshift-ovs-subnet/openshift-ovs-multitenant/g" /etc/origin/master/master-config.yaml'
    1. 重启master节点上的origin-master-api和origin-master-controllers服务
    1
    2
    $ ansible masters -m service -a 'name=origin-master-api state=restarted' -f 1
    $ ansible masters -m service -a 'name=origin-master-controllers state=restarted' -f 1
    1. 停止节点上的origin-node服务
    1
    $ ansible all -m service -a 'name=origin-node state=stopped'
    1. 在所有节点上重启openvswitch服务
    1
    $ ansible all -m service -a 'name=openvswitch state=restarted'
    1. 在所有节点上重启origin-node服务
    1
    $ ansible all -m service -a 'name=origin-node state=started'
    1. 如果是从openshift sdn插件切换到第三方插件,需要清空将openshit sdn的特性
    1
    2
    3
    $ oc delete clusternetwork --all
    $ oc delete hostsubnets --all
    $ oc delete netnamespaces --all
    1. 检查VNIDs
    1
    $ oc get netnamespace

Openshift SDN网络插件ovs-multitenant 切换到 ovs-networkpolicy

  1. 下载切换脚本并更改执行权限
1
2
$ curl -O https://raw.githubusercontent.com/openshift/origin/master/contrib/migration/migrate-network-policy.sh
$ chmod a+x migrate-network-policy.sh
  1. 执行脚本,openshift使用cluster-admin权限的用户
1
$ ./migrate-network-policy.sh