2

I have created a pod and service for nginx in a cloud compute VM and with port forward I am able to forward the service to local port, which I am able to access it on browser as http://vm_ip:port.

The result - The page is displayed.

Now I have created an ingress with TLS enabled and mapped the minikube ip with backend dns name for e.g backend.minikube.local. I enabled the TLS using self signed certificate.

I tested the response using curl in VM and I get the result for https (output of result below)

#curl --cacert tls.crt https://backend.minikube.local
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Now, how can I view the same from browser from my desktop? I tried to port forward ingress but it fails -

kubectl port-forward --address 0.0.0.0 ingress/nginx 8080:80

error: cannot attach to *v1.Ingress: selector for *v1.Ingress not implemented

Do port-forward only works for pods, service and deployment? not for reverse-proxy?

Please share the solution or insight if anyone able to make it work on browswer.

Thanks.

Vinu Pillai
  • 107
  • 7
  • Did you try to use the minikube ip instead of `0.0.0.0`? Because on the curl command you use `https://backend.minikube.local`. – Felipe Dec 06 '21 at 06:25
  • @Felipe Yes I tried but I get the following error - `#kubectl port-forward --address 192.168.59.2 svc/nginx 8080:80 Unable to listen on port 8080: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 192.168.59.2:8080: bind: cannot assign requested address] error: unable to listen on any of the requested ports: [{8080 80}]` – Vinu Pillai Dec 08 '21 at 14:52
  • Try this https://stackoverflow.com/a/56442102/2096986 – Felipe Dec 08 '21 at 18:56
  • @VinuPillai Were you able to solve this issue? Also, how you mapped minikube ip with backend dns in ingress? I'm unable to do that – Sammy Jul 25 '23 at 17:27

0 Answers0