You can install OpenShift Local (crc) on your Windows workstation but OpenShift Local runs as localhost. If you want to use Linux for instance to build images with docker or podman you can use WSL. Unfortunately WSL can not directly access OpenShift Local because it binds to localhost. To solve that I have installed nginx on Windows and configured it as a reverse proxy.
- First install OpenShift Local
https://developers.redhat.com/products/openshift-local/overview - Install WSL
https://learn.microsoft.com/en-us/windows/wsl/install - Install Nginx on Windows
https://nginx.org/en/docs/windows.html
WSL
Download the oc binary and copy it e.g. to /usr/local/bin in WSL.
Configure Nginx
In WSL get the IP-address for Windows within WSL. That is the default part of the command:
$ ip route
default via 172.30.208.1 dev eth0 proto kernel
172.30.208.0/20 dev eth0 proto kernel scope link src 172.30.214.37
So it this case it is 172.30.208.1. Make the Nginx server listen on that IP-address and port 6443.
Also create a self signed certificate for TLS:
openssl req -x509 -nodes -newkey rsa:2048 -keyout localhost.key -out localhost.crt -days 365
Snippet nginx.conf:
server {
listen 172.30.208.1:6443 ssl;
server_name 172.30.208.1;
ssl_certificate localhost.crt;
ssl_certificate_key localhost.key;
location / {
proxy_pass https://api.crc.testing:6443/;
}
If you have downloaded nginx as a zip-file you can start and stop it with:
start nginx
nginx -s stop
Add the following to the /etc/hosts file in WSL:
172.30.208.1 oauth-openshift.apps-crc.testing
172.30.208.1 api.crc.testing
172.30.208.1 console-openshift-console.apps-crc.testing
172.30.208.1 default-route-openshift-image-registry.apps-crc.testing
Now you can use WSL to work with openShift.
$ oc login -u developer https://api.crc.testing:6443
$ oc config current-context
openshift-image-registry/api-crc-testing:6443/developer