// Module included in the following assemblies:
//
// * cloud_experts_tutorials/cloud-experts-consistent-egress-ip.adoc

:_mod-docs-content-type: PROCEDURE
[id="cloud-experts-consistent-egress-ip-assign-ip-namespace_{context}"]
= Assign an egress IP to a namespace

[role="_abstract"]
Assign an egress IP to a namespace on your cluster to ensure that all pods inside it use a consistent, predictable address for external connections.

.Procedure
. Create a new project by running the following command:
+
[source,terminal]
----
$ oc new-project demo-egress-ns
----

. Create the egress rule for all pods within the namespace by running the following command:
+
[source,terminal]
----
$ cat <<EOF | oc apply -f -
apiVersion: k8s.ovn.org/v1
kind: EgressIP
metadata:
  name: demo-egress-ns
spec:
  # NOTE: these egress IPs are within the subnet range(s) in which my worker nodes
  #       are deployed.
  egressIPs:
    - 10.10.100.253
    - 10.10.150.253
    - 10.10.200.253
  namespaceSelector:
    matchLabels:
      kubernetes.io/metadata.name: demo-egress-ns
EOF
----