This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.12.4. Editing an egress firewall for a project
As a cluster administrator, you can modify network traffic rules for an existing egress firewall.
12.4.1. Editing an EgressNetworkPolicy object 复制链接链接已复制到粘贴板!
As a cluster administrator, you can update the egress firewall for a project.
Prerequisites
- A cluster using the OpenShift SDN network plug-in.
-
Install the OpenShift CLI (
oc
). - You must log in to the cluster as a cluster administrator.
Procedure
To edit an existing egress network policy object for a project, complete the following steps:
Find the name of the EgressNetworkPolicy object for the project. Replace
<project>
with the name of the project.oc get -n <project> egressnetworkpolicy
$ oc get -n <project> egressnetworkpolicy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: If you did not save a copy of the EgressNetworkPolicy object when you created the egress network firewall, enter the following command to create a copy.
oc get -n <project> \ egressnetworkpolicy <name> \ -o yaml > <filename>.yaml
$ oc get -n <project> \
1 egressnetworkpolicy <name> \
2 -o yaml > <filename>.yaml
3 Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to replace the EgressNetworkPolicy object. Replace
<filename>
with the name of the file containing the updated EgressNetworkPolicy object.oc replace -f <filename>.yaml
$ oc replace -f <filename>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.4.2. EgressNetworkPolicy custom resource (CR) object 复制链接链接已复制到粘贴板!
The following YAML describes an EgressNetworkPolicy CR object:
12.4.2.1. EgressNetworkPolicy rules 复制链接链接已复制到粘贴板!
The following YAML describes an egress firewall rule object. The egress
key expects an array of one or more objects.
egress: - type: <type> to: cidrSelector: <cidr> dnsName: <dns-name>
egress:
- type: <type>
to:
cidrSelector: <cidr>
dnsName: <dns-name>
12.4.2.2. Example EgressNetworkPolicy CR object 复制链接链接已复制到粘贴板!
The following example defines several egress firewall policy rules: