$ oc edit pod <name>
As a cluster user you can remove a Pod from an additional network.
You can remove a Pod from an additional network.
You have configured an additional network for your cluster.
You have an additional network attached to the Pod.
Install the OpenShift Command-line Interface (CLI), commonly known as oc
.
You must log in to the cluster.
To remove a Pod from an additional network, complete the following steps:
Edit the Pod resource definition by running the following command. Replace
<name>
with the name of the Pod to edit.
$ oc edit pod <name>
Update the annotations
mapping to remove the additional network from the
Pod by performing one of the following actions:
To remove all additional networks from a Pod, remove the
k8s.v1.cni.cncf.io/networks
parameter from the Pod resource definition as in
the following example:
apiVersion: v1
kind: Pod
metadata:
name: example-pod
annotations: {}
spec:
containers:
- name: example-pod
command: ["/bin/bash", "-c", "sleep 2000000000000"]
image: centos/tools
To remove a specific additional network from a Pod, update the
k8s.v1.cni.cncf.io/networks
parameter by removing the name of the
NetworkAttachmentDefinition for the additional network.
Optional: Confirm that the Pod is no longer attached to the additional network
by running the following command. Replace <name>
with the name of the Pod.
$ oc describe pod <name>
In the following example, the example-pod
Pod is attached only to the default
cluster network.
$ oc describe pod example-pod Name: example-pod ... Annotations: k8s.v1.cni.cncf.io/networks-status: [{ "name": "openshift-sdn", "interface": "eth0", "ips": [ "10.131.0.13" ], "default": true, (1) "dns": {} }] Status: Running ...
1 | Only the default cluster network is attached to the Pod. |