Skip to content

Instantly share code, notes, and snippets.

@sshnaidm
Last active March 15, 2022 13:47
Show Gist options
  • Save sshnaidm/189e551d723938014750e7c738944c00 to your computer and use it in GitHub Desktop.
Save sshnaidm/189e551d723938014750e7c738944c00 to your computer and use it in GitHub Desktop.
Run CRC with openshift on remote server
  1. Download form https://crc.dev/crc/
wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
  1. Start CRC
crc setup
crs start -m 32768 -c 8 # for example a 32GiB with 8 cpus
  1. Install haproxy sudo dnf -y install haproxy policycoreutils-python-utils jq
  2. Stop firewalld (or add rules to allow 80, 443, 6443)
sudo systemctl stop firewalld
sudo systemctl disable firewalld
  1. Set selinux for permissive sudo setenforce 0
  2. Set haproxy config where 10.9.113.12 is your external server IP and 192.168.130.11 is IP of CRC virtual machine. To discover CRC IP: crc ip To discover IP of your host: hostname --ip-address
cat <EOF>> /tmp/haproxy.cfg
global
        debug

defaults
        log global
        mode    http
        timeout connect 5000
        timeout client 5000
        timeout server 5000

frontend apps
    bind 10.9.113.12:80
    option tcplog
    mode tcp
    default_backend apps

backend apps
    mode tcp
    balance roundrobin
    option ssl-hello-chk
    server webserver1 192.168.130.11:80 check

frontend apps-https
    bind 10.9.113.12:443
    option tcplog
    mode tcp
    default_backend apps-https

backend apps-https
    mode tcp
    balance roundrobin
    option ssl-hello-chk
    server webserver1 192.168.130.11:443 check

frontend api
    bind 10.9.113.12:6443
    option tcplog
    mode tcp
    default_backend api

backend api
    mode tcp
    balance roundrobin
    option ssl-hello-chk
    server webserver1 192.168.130.11:6443 check
EOF
sudo cp /tmp/haproxy.cfg /etc/haproxy/haproxy.cfg
sudo systemctl start haproxy
  1. Add to your /etc/hosts:
# CRC openshift
10.9.113.12 api.crc.testing api-int.crc.testing apps-crc.testing canary-openshift-ingress-canary.apps-crc.testing console-openshift-console.apps-crc.testing default-route-openshift-image-registry.apps-crc.testing downloads-openshift-console.apps-crc.testing oauth-openshift.apps-crc.testing

Where 10.9.113.12 is your external host IP.

  1. Download oc client from https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/ and authenticate: Discover your credentials by crc console --credentials
oc login -u kubeadmin -p <kubeadmin password>  https://api.crc.testing:6443

or as a regular user:

oc login -u developer -p developer https://api.crc.testing:6443
  1. Open page in your browser: https://console-openshift-console.apps-crc.testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment