Delete a network policy using the CLI
You can delete a network policy in a namespace.
|
|
If you log in with |
|
|
If you log in with |
-
Your cluster uses a network plugin that supports
NetworkPolicyobjects, such as the OVN-Kubernetes network plugin, withmode: NetworkPolicyset. -
You installed the OpenShift CLI (
oc). -
You logged in to the cluster with a user with
adminprivileges. -
You are working in the namespace where the network policy exists.
-
To delete a network policy object, enter the following command. Successful output lists the name of the policy object and the
deletedstatus.$ oc delete networkpolicy <policy_name> -n <namespace>where:
<policy_name>-
Specifies the name of the network policy.
<namespace>-
Optional parameter. If you defined the object in a different namespace than the current namespace, the parameter specifices the namespace.