Skip to content

Instantly share code, notes, and snippets.

@williamcaban
Last active June 24, 2020 22:08
Show Gist options
  • Save williamcaban/759be5b0d0a6b2a49c5f6425a857b863 to your computer and use it in GitHub Desktop.
Save williamcaban/759be5b0d0a6b2a49c5f6425a857b863 to your computer and use it in GitHub Desktop.

Enabling externalIPs on OCP4.2

Edit the config for the network Custom Resource (CR) instance spec.externalIP.policy.allowedCIDRs with the CIDRs to use.

  1. Edit the Cluster network configuration:
oc edit network.config.openshift.io cluster
  1. Edit the spec.externalIP.policy.allowedCIDRs. The following enable 192.168.18.64/26 as an externalIP CIDR:
....
spec:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  externalIP:
    policy:
      allowedCIDRs:
      - 192.168.18.64/26
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16
...
  1. Validate changes where applied to the CR
oc get network.operator.openshift.io  cluster -o yaml
  1. Wait few minutes while the Network Operator apply the configuration changes
oc patch svc demo-service -p '{"spec":{"externalIPs":["192.168.18.65"]}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment