<p>I am really new to kubernetes and nginx. I am able to use it as a reverse-proxy by setting up ingress resource, however, I am not sure about how should I use it to forward the request from kubernetes to a particular host. </p>

<p>My case is as follows:
I have a container running in kubernetes pod which access an external api url (example www.xxx.com) with some parameters, however, because I have blocked the outgoing requests for all the pods, it can not access that api url. </p>

<p>To solve this I want to setup nginx proxy which will forward my request to the actual api url. </p>

<p>Being new to this and having lack of proper steps documented anywhere to achieve this, I am really stuck. How can I do this?</p>

<p>What you could do is to define a Service object that points to your external API endpoint. This is done by creating an Endpoint object and a Service object both with the same name.</p>

<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#services-without-selectors" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#services-without-selectors</a></p>

<p>Once you have your service, you could create an Ingress rule that would forward the traffic to that service. Make sure that the Ingress controller can access your API endpoint.</p>
