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-networkpolicy-delete-cli.adoc
2026-01-23 19:49:33 +00:00

65 lines
2.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/network_security/network_policy/deleting-network-policy.adoc
// * networking/multiple_networks/configuring-multi-network-policy.adoc
// * microshift_networking/microshift-network-policy/microshift-editing-network-policy.adoc
:name: network
:role: admin
ifeval::["{context}" == "configuring-multi-network-policy"]
:multi:
:name: multi-network
:role: cluster-admin
endif::[]
:_mod-docs-content-type: PROCEDURE
[id="nw-networkpolicy-delete-cli_{context}"]
= Deleting a {name} policy using the CLI
[role="_abstract"]
You can delete a {name} policy in a namespace.
ifndef::multi[]
[NOTE]
====
If you log in with `cluster-admin` privileges, you can delete network policies in any namespace in the cluster.
====
endif::multi[]
ifndef::microshift[]
[NOTE]
====
If you log in with `cluster-admin` privileges, you can delete network policies in any namespace in the cluster. In the web console, you can delete policies directly in YAML or by using the *Actions* menu.
====
endif::microshift[]
.Prerequisites
ifndef::microshift[]
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
endif::microshift[]
* You installed the OpenShift CLI (`oc`).
ifndef::microshift[]
* You logged in to the cluster with a user with `{role}` privileges.
endif::microshift[]
* You are working in the namespace where the {name} policy exists.
.Procedure
* To delete a {name} policy object, enter the following command. Successful output lists the name of the policy object and the `deleted` status.
+
[source,terminal,subs="attributes+"]
----
$ oc delete {name}policy <policy_name> -n <namespace>
----
+
where:
+
`<policy_name>`:: Specifies the name of the {name} policy.
`<namespace>`:: Optional parameter. If you defined the object in a different namespace than the current namespace, the parameter specifices the namespace.
ifdef::multi[]
:!multi:
endif::multi[]
:!name:
:!role: