Your work involves using a corporate network for Internet access, which blocks accessing anything other than port 22/80/443 on a remote server.
Kubernetes services deployed with NodePorts use a high TCP port range ~ 30000 which is blocked
Install a reverse proxy to route traffic from port 80 to your high port, use different hostnames if you have multiple services.
Let's route NodePort 31112 from OpenFaaS to port 80.
Perform all these steps on your remote cloud instance / server.
apt install -qy nginx
/etc/nginx/conf.d/openfaas.conf
server {
listen 80;
server_name _;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:31112;
}
}
sudo systemctl daemon-reload
sudo systemctl restart nginx
Now access the OpenFaaS UI via port 80.
- Check the logs
systemctl status nginx.service
- Test the config
Test
nginx -t
Test and print result
nginx -T
- Check for conflicting default config files
You may have another, default configuration file for NGinx which is conflicting with your new config file. Look for default.conf or similar one level down from the /etc/nginx/
folder and remove it. It may be in /etc/nginx/sites-available/
or /etc/nginx/conf.d
or similar.