<p>I managed to create and deploy a k8s cluster with minikube, running 4 replicas of a simple hello-world node.js app, using the following configuration.</p>

<p>Dockerfile for the app:</p>

<pre><code>FROM ubuntu:latest

RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm
# TODO could uninstall some build dependencies

# debian installs `node` as `nodejs`
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

COPY package.json package.json

RUN npm install

COPY . .

CMD ["node", "app.js"]
</code></pre>

<p>k8s Deployment yml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-deployment
  labels:
    app: node-app
spec:
  replicas: 4
  selector:
    matchLabels:
      app: node-app
  template:
    metadata:
      labels:
        app: node-app
    spec:
      containers:
      - name: node-app
        image: my-repo/ubuntu-node:sectry 
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: node-service
  labels:
    app: node-app
spec:
  type: NodePort
  ports:
  - port: 3000
    protocol: TCP
  selector:
    app: node-app
</code></pre>

<p>My question is how can add an nginx container for it? I know k8s cluster already load-balancing, but I really wish to use NGINX features.</p>

<p>I would add third option : use an Ingress Controller <a href="https://github.com/nginxinc/kubernetes-ingress" rel="nofollow noreferrer">https://github.com/nginxinc/kubernetes-ingress</a>.</p>

<p>It will create all this features that you are looking for and built in on K8s. </p>
