Steps to deploy a node application into Kubernetes EKS

  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
  • 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 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`
  • 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 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.
  • 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.
  • List the pods `kubectl get pods -n ingress-nginx`
  • List the services `kubectl get svc -n ingress-nginx`
  • 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>`
  • 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 and point the sub domain to the above mentioned host address.
  • Now you can access the application using




Providing simple solutions for complex problems.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Cloud-Native Notification Services

CCleaner Download For Windows 7 & 10 | CCleaner Ver. 5.25.5902 Download — Backbenz

Use A Domain Data API To Prove The Value Of Your Company

Part 2: A comparison of CRUD and CQRS patterns using shopping cart application

Get Lead Prices Fluctuation Data With This API

Get Silver Rates Using Python With This API

Should you get a Master’s Degree in Data Science? A faculty perspective.

Slaying God Objects using Bounded Contexts

Photograph of Michelangelo’s paintings from the ceiling of the Sistine Chapel.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prince Francis

Prince Francis

Providing simple solutions for complex problems.

More from Medium

‘Deploy MongoDB to Kubernetes

Deep dive in Docker: Tips and Tricks to build Docker images optimized for security and size.

Fixed a python App deployed on a Kubernetes Cluster

How to get continuous stream of logs in Kubernetes?