mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * networking/multiple_networks/secondary_networks/creating-secondary-nwt-ovnk.adoc
|
|
|
|
:_mod-docs-content-type: CONCEPT
|
|
[id="configuring-pods-static-ip_{context}"]
|
|
= Configuring pods with a static IP address
|
|
|
|
[role="_abstract"]
|
|
You can configure pods with a static IP address. The example in the procedure provisions a pod with a static IP address.
|
|
|
|
[NOTE]
|
|
====
|
|
* You can specify the IP address for the secondary network attachment of a pod only when the secondary network attachment, a namespaced-scoped object, uses a layer 2 or localnet topology.
|
|
* Specifying a static IP address for the pod is only possible when the attachment configuration does not feature subnets.
|
|
====
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
annotations:
|
|
k8s.v1.cni.cncf.io/networks: '[
|
|
{
|
|
"name": "l2-network",
|
|
"mac": "02:03:04:05:06:07",
|
|
"interface": "myiface1",
|
|
"ips": [
|
|
"192.0.2.20/24"
|
|
]
|
|
}
|
|
]'
|
|
name: tinypod
|
|
namespace: ns1
|
|
spec:
|
|
containers:
|
|
- args:
|
|
- pause
|
|
image: k8s.gcr.io/e2e-test-images/agnhost:2.36
|
|
imagePullPolicy: IfNotPresent
|
|
name: agnhost-container
|
|
----
|
|
|
|
where:
|
|
|
|
|
|
`k8s.v1.cni.cncf.io/networks.name`:: The name of the network. This value must be unique across all `NetworkAttachmentDefinition` CRDs.
|
|
`k8s.v1.cni.cncf.io/networks.mac`:: The MAC address to be assigned for the interface.
|
|
`k8s.v1.cni.cncf.io/networks.interface`:: The name of the network interface to be created for the pod.
|
|
`k8s.v1.cni.cncf.io/networks.ips`:: The IP addresses to be assigned to the network interface.
|