Goglides Dev 🌱

Balkrishna Pandey
Balkrishna Pandey

Posted on

How to forward ports to see the Nginx server page using the browser?

Let's port forward to the Nginx pod created by the deployment we created in the previous step. To do this, we'll use Kubectl to forward traffic from our local machine (the host) to the Nginx pod.

kubectl port-forward deployment/nginx 8080:80 

Enter fullscreen mode Exit fullscreen mode


Forwarding from -> 80

Forwarding from [::1]:8080 -> 80

Handling connection for 8080

Enter fullscreen mode Exit fullscreen mode

To verify open different terminals and run the following command,

curl localhost:8080

Enter fullscreen mode Exit fullscreen mode


<!DOCTYPE html>



<title>Welcome to nginx!</title>


html { color-scheme: light dark; }

body { width: 35em; margin: 0 auto;

font-family: Tahoma, Verdana, Arial, sans-serif; }




<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>



Enter fullscreen mode Exit fullscreen mode

You can also use web browser and type, http://localhost:8080 to see the nginx server page.

Now that we have seen how to port forward ports from deployments and run commands inside containers, let's look at some more advanced deployment operations.

Top comments (0)