OpenShift Local CRC From Another Machine

During the preparation of my “Learning OpenShift” course for LinkedIn Learning, I used OpenShift Local (formerly known as “CodeReady Containers” or CRC) to demonstrate the various features of the platform from a developer’s point of view.

The issue with my setup was that, given the resource requirements of CRC, it made my laptop fan run wild, which was a problem since I needed to record my voice as I used the product. To solve this issue, I installed OpenShift Local CRC in a computer in another room connected to my home LAN, and I configured my laptop to access it as if it were running locally using HAProxy.

This blog post took me to this gist, but the instructions there didn’t work on Fedora 38. However, in the comments below the gist there’s a reference to this other blog post that actually worked. The final procedure I followed is reproduced here:

On the Server

  1. Install HAProxy:
$ sudo dnf install -y haproxy
$ sudo systemctl enable haproxy
$ sudo systemctl start haproxy
  1. Configure HAProxy:
$ export CRC_IP=$(crc ip)
$ sudo tee /etc/haproxy/haproxy.cfg &>/dev/null <<EOF
global
    log /dev/log local0

defaults
    balance roundrobin
    log global
    maxconn 100
    mode tcp
    timeout connect 5s
    timeout client 500s
    timeout server 500s

listen app
    bind 0.0.0.0:80
    server crcvm $CRC_IP:80 check

listen apps_ssl
    bind 0.0.0.0:443
    server crcvm $CRC_IP:443 check

listen api
    bind 0.0.0.0:6443
    server crcvm $CRC_IP:6443 check
EOF
  1. Restart HAProxy:
$ sudo systemctl restart haproxy
  1. Get the IPv4 of the server:
$ ip address show

On the Client

  1. Add the entry below to the /etc/hosts file, where xx.xx.xx.xx is the IPv4 of the server you got previously:
xx.xx.xx.xx api.crc.testing console-openshift-console.apps-crc.testing default-route-openshift-image-registry.apps-crc.testing oauth-openshift.apps-crc.testing
  1. Open the console on your client machine with the usual URL, and enjoy a quiet recording environment, while the fan of your server is buzzing in a separate room.