Skip to content

Instantly share code, notes, and snippets.

@ralvares
Last active February 23, 2021 10:49
Show Gist options
  • Select an option

  • Save ralvares/32fd85e6ae378d152cc0baea21ff9d93 to your computer and use it in GitHub Desktop.

Select an option

Save ralvares/32fd85e6ae378d152cc0baea21ff9d93 to your computer and use it in GitHub Desktop.
oc edit Network.config.openshift.io cluster
---
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: config.openshift.io/v1
kind: Network
metadata:
creationTimestamp: "2021-02-12T11:31:50Z"
generation: 3
name: cluster
resourceVersion: "1444520"
selfLink: /apis/config.openshift.io/v1/networks/cluster
uid: 7103512a-6b57-4ef5-8d8a-41bf119809ea
spec:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
externalIP:
autoAssignCIDRs:
- 192.168.131.192/26
policy:
allowedCIDRs:
- 192.168.131.128/26
networkType: OVNKubernetes
serviceNetwork:
- 172.30.0.0/16
status:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
clusterNetworkMTU: 1400
networkType: OVNKubernetes
serviceNetwork:
- 172.30.0.0/16
---
oc patch svc golang -p '{"spec":{"externalIPs":["192.168.131.129"]}}'
---
oc get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
golang ClusterIP 172.30.99.140 192.168.131.129 8080/TCP 2d7h
nginx-example ClusterIP 172.30.158.210 <none> 8080/TCP 2d8h
---
Must configure your networking infrastructure to ensure that the external IP address blocks that you define are routed to the cluster and check that firewall should not block that traffic.
To test:
192.168.50.13 is one of the Worker Nodes ( In case of IPI, use the ingress VIP )
---
ip route add 192.168.131.128/26 via 192.168.50.13
---
[user@cloud ~]$ curl 192.168.131.129:8080
Hello OpenShift!
:D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment