1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00

Merge pull request #94358 from ShaunaDiaz/OSDOCS-14866

OSDOCS-14866: correct typo and file errors NW docs MicroShift
This commit is contained in:
Shauna Diaz
2025-06-06 11:05:27 -04:00
committed by GitHub
2 changed files with 20 additions and 19 deletions

View File

@@ -50,7 +50,7 @@ All of the pods in the cluster still use the cluster-wide default network to mai
* The CNI configuration is created when the {microshift-short} Multus DaemonSet starts. This configuration is autogenerated and includes the primary CNI that is the default delegate. For {microshift-short}, the default CNI is OVN-Kubernetes.
[id="microshift-additional-network-how-attached-pods_{context}"]
== How to attached secondary networks to pods
== How to attach secondary networks to pods
To attach secondary network interfaces to a pod, you must create and apply configurations that define how the interfaces are attached.

View File

@@ -12,7 +12,7 @@ If you want to attach additional networks to a pod that is already running, you
.Prerequisites
* The OpenShift CLI (`oc`) is installed.
* The {oc-first} is installed.
* The cluster is running.
* A network defined by a `NetworkAttachmentDefinition` object that you want to attach the pod to exists.
@@ -22,17 +22,16 @@ If you want to attach additional networks to a pod that is already running, you
.. To attach an additional network without any customization, add an annotation with the following format. Replace `_<network>_` with the name of the additional network to associate with the pod:
+
[source,yaml]
[subs="+quotes"]
[source,yaml,subs="+quotes"]
----
apiVersion: v1
kind: Pod
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: __<network>__[,__<network>__,...] # <1>
k8s.v1.cni.cncf.io/networks: _<network>_[,_<network>_,...] <1>
# ...
----
<1> Replace `_<network>_` with the name of the additional network to associate with the pod. To specify more than one additional network, separate each network with a comma. Do not include whitespace between the comma. If you specify the same additional network multiple times, that pod will have multiple network interfaces attached to that network.
<1> Replace `_<network>_` with the name of each additional network to associate with the pod. To specify more than one additional network, separate each network with a comma. Do not include whitespaces between the commas. If you specify the same additional network multiple times, that pod has multiple network interfaces attached to that network.
+
.Example annotation for a bridge-type additional network
+
@@ -57,9 +56,9 @@ metadata:
k8s.v1.cni.cncf.io/networks: |-
[
{
"name": "<network>", # <1>
"namespace": "<namespace>", # <2>
"default-route": ["<default-route>"] # <3>
"name": "<network>", <1>
"namespace": "<namespace>", <2>
"default-route": ["<default-route>"] <3>
}
]
# ...
@@ -70,10 +69,9 @@ metadata:
. To create a `Pod` YAML file and add the `NetworkAttachmentDefinition` annotation for an additional network, run the following command and use the example YAML:
+
[source,terminal]
[subs="+quotes"]
[source,terminal,subs="+quotes"]
----
$ oc apply -f ./__<test_bridge>__.yaml <1>
$ oc apply -f ./_<test_bridge>_.yaml <1>
----
<1> Replace `_<test_bridge>_` with the pod name that you want to use.
+
@@ -132,21 +130,23 @@ metadata:
. Optional: To confirm that the `NetworkAttachmentDefinition` annotation exists in a `Pod` YAML, run the following command, replacing `_<name>_` with the name of the pod.
+
[source,terminal]
[subs="+quotes"]
[source,terminal,subs="+quotes"]
----
$ oc get pod __<name>__ -o yaml <1>
$ oc get pod _<name>_ -o yaml <1>
----
<1> Replace `_<name>_` with the pod name you want to use. In the following example, `_<test_bridge>_` is used.
+
In the following example, the `test_bridge` is attached to the `net1` additional network:
+
[source,terminal]
[subs="+quotes"]
--
[source,terminal,subs="+quotes"]
----
$ oc get pod __<test_bridge>__ -o yaml
$ oc get pod _<test_bridge>_ -o yaml <1>
----
<1> Replace _<test_bridge>_ with the name of the bridge you want to use.
--
+
--
.Example output
[source,yaml]
----
@@ -155,7 +155,7 @@ kind: Pod
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: bridge-conf
k8s.v1.cni.cncf.io/network-status: |- # <1>
k8s.v1.cni.cncf.io/network-status: |- <1>
[{
"name": "ovn-kubernetes",
"interface": "eth0",
@@ -181,6 +181,7 @@ status:
# ...
----
<1> The `k8s.v1.cni.cncf.io/network-status` parameter is a JSON array of objects. Each object describes the status of an additional network attached to the pod. The annotation value is stored as a plain text value.
--
. Verify that the pod is running by running the following command:
+