<p>I am learning kubernetes and got into a point where I am very confused. I have installed metallb and <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">ingress-nginx</a> so it is possible to access content from outside. I saw several examples that are using <a href="https://hub.docker.com/_/nginx" rel="nofollow noreferrer">nginx image</a> running in pod despite they are also using ingress-nginx.</p>
<p>Isn't ingress-nginx capable to do all work as nginx image? Otherwise what roles those two play?</p>
<p>I need to deploy express server where I would like to utilize some nginx features like gzip so it is where reverse proxy comes.</p>
<p>So do I need to make it work on ingress-nginx level or from nginx image? And if I need nginx image does it mean that I need to run separately nginx image and my built node image with my express app?</p>

<p>Short answer: <strong>No</strong><br />
But it's complicated.</p>
<p><code>nginx</code> <a href="https://hub.docker.com/_/nginx" rel="nofollow noreferrer">image</a> you mentioned is one of the most popular images (5th on the Docker Hub, by the time of this writing), is relatively small (133MB), and is easy to remember. That's why it is widely used as an example in many tutorials.</p>
<hr />
<blockquote>
<p>Isn't ingress-nginx capable to do all work as nginx image?</p>
</blockquote>
<p>To some extent.<br />
<em>Pod</em> and <em>Ingress</em> are different Kubernetes resources, and they act differently. <code>nginx</code> image is usually deployed as a container inside a pod.</p>
<p>In case of <em>nginx ingress controller</em>, similiar image is used for both <em>Pod</em> and <em>Ingress</em> (mentioned below).</p>
<p>Whenever you deploy (for example) a rewrite rule in ingress controller</p>
<pre><code>metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
</code></pre>
<p>corresponding entry is being created in <code>nginx.conf</code> file in <code>nginx-ingress</code> image (again, mentioned below).</p>
<p>You can read more <a href="https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengsettingupingresscontroller.htm" rel="nofollow noreferrer">here</a>.</p>
<hr />
<p>That being said, there is <a href="https://hub.docker.com/r/nginx/nginx-ingress/" rel="nofollow noreferrer"><code>nginx/nginx-ingress</code></a> image that is being deployed when you create <em>Ingress Controller</em> resource.<br />
You can even pull it from Docker Hub</p>
<pre><code>$ docker image pull nginx; docker image pull nginx/nginx-ingress
Using default tag: latest
latest: Pulling from library/nginx
69692152171a: Pull complete 
30afc0b18f67: Pull complete 
596b1d696923: Pull complete 
febe5bd23e98: Pull complete 
8283eee92e2f: Pull complete 
351ad75a6cfa: Pull complete 
Digest: sha256:6d75c99af15565a301e48297fa2d121e15d80ad526f8369c526324f0f7ccb750
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
Using default tag: latest
latest: Pulling from nginx/nginx-ingress
69692152171a: Already exists 
30afc0b18f67: Already exists 
596b1d696923: Already exists 
febe5bd23e98: Already exists 
8283eee92e2f: Already exists 
351ad75a6cfa: Already exists 
ff0027f23312: Pull complete 
18361787d4a4: Pull complete 
e1aba8353cbb: Pull complete 
f9a4438768c4: Pull complete 
Digest: sha256:a57fc7835c14b7294180f5c11ae6b81f2745189ef2adb57a5188952bf8aaa17a
Status: Downloaded newer image for nginx/nginx-ingress:latest
docker.io/nginx/nginx-ingress:latest
</code></pre>
<pre><code>$ docker image ls
REPOSITORY            TAG       IMAGE ID       CREATED       SIZE
nginx/nginx-ingress   latest    1bc8d3e90493   2 weeks ago   177MB
nginx                 latest    d1a364dc548d   2 weeks ago   133MB
</code></pre>
<p>As you can see <code>nginx</code> and <code>nginx-ingress</code> are two different images.</p>
<p>In fact, you can even <a href="https://docs.nginx.com/nginx-ingress-controller/installation/building-ingress-controller-image/" rel="nofollow noreferrer">build the image</a> yourself.</p>
