Deleting NetworkPolicies in Batches
Function
This API is used to delete a collection of NetworkPolicies.
URL
DELETE /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
body |
Yes |
- |
Request
N/A
Example response:
{
"kind": "NetworkPolicyList",
"apiVersion": "extensions/v1beta1",
"metadata": {
"selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies",
"resourceVersion": "1105434"
},
"items": [
{
"metadata": {
"name": "test111",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies/test111",
"uid": "c4ca7f4e-ed3a-11e8-85b0-fa163e2ce5f0",
"resourceVersion": "1105348",
"generation": 1,
"creationTimestamp": "2018-11-21T03:08:50Z",
"labels": {
"app": "nginx"
}
},
"spec": {
"podSelector": {
"matchLabels": {
"app": "nginx"
}
},
"ingress": [
{
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"from": [
{
"namespaceSelector": {
"matchLabels": {
"project": "default"
}
}
}
]
}
],
"policyTypes": [
"Ingress"
]
}
},
{
"metadata": {
"name": "test222",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies/test222",
"uid": "9017a491-ed3a-11e8-85b0-fa163e2ce5f0",
"resourceVersion": "1105156",
"generation": 1,
"creationTimestamp": "2018-11-21T03:07:21Z",
"labels": {
"app": "nginx"
}
},
"spec": {
"podSelector": {
"matchLabels": {
"app": "nginx"
}
},
"ingress": [
{
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"from": [
{
"podSelector": {
"matchLabels": {
"app": "nginx"
}
}
}
]
}
],
"policyTypes": [
"Ingress"
]
}
}
]
}
Status Code
Table 2 describes the status code of this API.
Last Article: Deleting a Specified NetworkPolicy
Next Article: Reading a Specified NetworkPolicy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.