Steps to deploy a node application into Kubernetes EKS

In this tutorial

  1. We’ll deploy a simple node-express application into EKS
  2. Configure nginx-ingress so that we can access via HTTP
  3. Configure ssl/tls certificate so that we can access via HTTPS

Link to GitHub repository



  • Connect to aws using the command `aws configure`. Use the above generated `AWS Access Key ID and AWS Access Secret`.
  • Verify eksctl installation using the command `eksctl version`
  • Verify aws configuration using the command `aws iam get-user`

Create sample node app

  • Create a project directory `mkdir ~/node-kubernetes-eks-deploy`
  • Switch to project direcoty `cd ~/node-kubernetes-eks-deploy`
  • Create directory `mkdir app`
  • Create a simple `express` app
  • Sample `server.js` file
  • Create a docker file named `Dockerfile` inside the folder `app`
  • Create a docker ignore file named `.dockerignore` with following contents
  • Now build docker image `docker build -t testkubernets:v1.0.0 -f Dockerfile .`
  • Verify by running `docker images`

Push docker images into eks repository in AWS

  • Open aws console `` and click on `Create Repository`
  • Choose `Visibility settings` as private
  • Give any name, say `testkubernets`
  • Leave other fields with default values
  • Now select the repository `aws-repository-list` and click `View Push Commands` button. Now you could see commands to push docker images into repository.
  • Login using the login command from the above command list.
  • Now tag the docker image created above. Use the command from the above list. Change the version name if requried. (default version name is `latest`) eg : `docker tag testkubernets:v1.0.0`
  • Verify it by running `docker images`
  • Now push the docker images into repository using the docker push command in the above command list. `docker push`
  • Wait for a few minutes to complete the command execution.

Create EKS Cluster

  • Create a yaml script in project root directory named `eks.yaml` with following contents.
  • `cd ..`
  • Change the aws region in the yaml script — eks.yaml
  • Create the cluster using the command `eksctl create cluster -f eks.yaml`
  • At any point of time, if you would like to delete the cluster, use the command `eksctl delete cluster -f eks.yaml`
  • Wait for a few minutes to complete the cluster creation process.

Deploy node app into Kubernetes

  • Create a folder `k8s` in project root folder
  • Create a yaml script named `1-testkubernetes.yaml`
  • Apply the above yaml script using the command `kubectl apply -f k8s/1-testkubernetes.yaml`
  • Verify it by listing the pods `kubectl get pods -n production`
  • List services using the command `kubectl get svc -n production`
  • Forward local 8080 port to kubernetes `kubectl -n production port-forward svc/testkubernetes 8080:8080`
  • Now open localhost:8080 in browser and verify it. Then CNTRL+C to stop port forwarding.

Deploy nginx ingress controller into Kubernetes

  • List the pods `kubectl get pods -n ingress-nginx`
  • List the services `kubectl get svc -n ingress-nginx`

Create ingress for NodeJs

  • Create a yaml script `k8s/3-http-ingress.yaml`
  • Deploy it using the command `kubectl apply -f k8s/3-http-ingress.yaml`
  • Verify it `kubectl get ing -n production`
  • Copy the address and issue command `nslookup <address copied>`
  • Verify it using the command `curl — resolve<ip address from above command>`

Create https ingress for NodeJs

  • If you have ssl certificates, you could configure ingress for https protocol.
  • Delete current secrets in the namespace if any, by using the command `kubectl delete secret tls tls-secret — namespace=production`. Where `tls-secret` is the name. We can give any name.
  • Create secret using the command `kubectl create secret tls tls-secret — namespace=production — key <path to private key> — cert <path to certificate file (bundle.crt)>`
  • Now change the `3-http-ingress.yaml` as in the github.
  • Deploy it into kubernetes using the command `kubectl apply -f k8s/3-http-ingress.yaml`
  • Find host name using `kubectl get ing -n production`
  • Find ip address using `nslookup`
  • Verify it using `curl — resolve`

Update CNAME in hosting provider

  • Update CNAME and point the sub domain to the above mentioned host address.
  • Now you can access the application using

Providing simple solutions for complex problems.