1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-egressnetworkpolicy-create.adoc

38 lines
1.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/network_security/configuring-egress-firewall-ovn.adoc
:_mod-docs-content-type: PROCEDURE
[id="nw-networkpolicy-create_{context}"]
= Creating an EgressNetworkPolicy custom resource (CR)
As a cluster administrator, you can create an `EgressNetworkPolicy` CR for a project.
[IMPORTANT]
====
If the project already has an `EgressNetworkPolicy` object defined, you must edit the existing policy to make changes to the egress firewall rules.
====
.Prerequisites
* A cluster that uses the OpenShift SDN network plugin.
* Install the OpenShift CLI (`oc`).
* You must log in to the cluster as a cluster administrator.
.Procedure
. Create a policy rule:
.. Create a `<policy_name>.yaml` file where `<policy_name>` describes the egress policy rules.
.. Define the `EgressNetworkPolicy` in the file.
. Create the policy object by entering the following command. Replace `<policy_name>` with the name of the policy and `<project>` with the project that the rule applies to.
+
[source,terminal]
----
$ oc create -f <policy_name>.yaml -n <project>
----
+
Successful output lists the `egressnetworkpolicy.network.openshift.io/v1` name and the `created` status.
. Optional: Save the `<policy_name>.yaml` file so that you can make changes later.