|
| 1 | +--- |
| 2 | +title: Egress IP |
| 3 | +linktitle: Egress IP |
| 4 | +description: Egress IP demo |
| 5 | +tags: ['Egress','v4.19'] |
| 6 | +--- |
| 7 | +# Some information |
| 8 | + |
| 9 | +Official documentation: <https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/ovn-kubernetes_network_plugin/configuring-egress-ips-ovn> |
| 10 | + |
| 11 | +Tested with: |
| 12 | + |
| 13 | +|Component|Version| |
| 14 | +|---|---| |
| 15 | +|OpenShift|v4.19.14| |
| 16 | + |
| 17 | +## Deploy Webserver |
| 18 | + |
| 19 | +TODO: Double check source IP |
| 20 | + |
| 21 | +This webserver is our target to check the source ip adress. |
| 22 | + |
| 23 | +```shell |
| 24 | +oc new-project rbohne-target |
| 25 | +oc apply -k [email protected]:openshift-examples/kustomize/components/simple-http-server |
| 26 | +``` |
| 27 | + |
| 28 | +## Prepare cluster |
| 29 | + |
| 30 | +```shell |
| 31 | +% oc get nodes -l node-role.kubernetes.io/worker |
| 32 | +NAME STATUS ROLES AGE VERSION |
| 33 | +inf44.coe.muc.redhat.com Ready worker 74d v1.32.5 |
| 34 | +ocp1-worker-0 Ready worker 79d v1.32.5 |
| 35 | +ocp1-worker-1 Ready worker 79d v1.32.5 |
| 36 | +ocp1-worker-2 Ready worker 79d v1.32.5 |
| 37 | + |
| 38 | +% oc label node/ocp1-worker-0 k8s.ovn.org/egress-assignable="" |
| 39 | +node/ocp1-worker-0 labeled |
| 40 | +% oc label node/ocp1-worker-1 k8s.ovn.org/egress-assignable="" |
| 41 | +node/ocp1-worker-1 labeled |
| 42 | +% oc label node/ocp1-worker-2 k8s.ovn.org/egress-assignable="" |
| 43 | +node/ocp1-worker-2 labeled |
| 44 | + |
| 45 | +oc apply -f - <<EOF |
| 46 | +heredoc> apiVersion: k8s.ovn.org/v1 |
| 47 | +kind: EgressIP |
| 48 | +metadata: |
| 49 | + name: egress-coe |
| 50 | +spec: |
| 51 | + egressIPs: |
| 52 | + - 10.32.105.72 |
| 53 | + - 10.32.105.73 |
| 54 | + namespaceSelector: |
| 55 | + matchLabels: |
| 56 | + egress: coe |
| 57 | +heredoc> EOF |
| 58 | +egressip.k8s.ovn.org/egress-coe created |
| 59 | +``` |
| 60 | +
|
| 61 | +## Deployment |
| 62 | +
|
| 63 | +```shell |
| 64 | +oc new-project rbohne-egress |
| 65 | +oc deploy -k simple-nginx... |
| 66 | +oc rsh deployment/simple-nginx |
| 67 | +curl $WEBSERVER |
| 68 | +
|
| 69 | +oc label namespace/rbohne-egress egress=coe |
| 70 | +
|
| 71 | +``` |
| 72 | +
|
| 73 | +```log |
| 74 | +10.32.96.44 - - [31/Aug/2025:11:54:00 +0200] "GET / HTTP/1.1" 301 247 "-" "curl/7.76.1" |
| 75 | +10.32.105.72 - - [31/Aug/2025:11:56:31 +0200] "GET / HTTP/1.1" 301 247 "-" "curl/7.76.1" |
| 76 | +``` |
0 commit comments