Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.81 KB

clh6u7zmv000709l3hkg39k70.md

File metadata and controls

54 lines (35 loc) · 1.81 KB
title datePublished cuid slug cover tags
Deploy React app to kubernetes on AWS EC2
Tue May 02 2023 22:25:04 GMT+0000 (Coordinated Universal Time)
clh6u7zmv000709l3hkg39k70
deploy-react-app-to-kubernetes-on-aws-ec2
docker, aws, kubernetes, developer, devops
  • First we need to setup and configure minikube on AWS EC2 instance.

  • Checkout this for setup minikube on AWS EC2 instance: https://blog.kubekode.org/setup-minikube-on-aws-ec2-instance

  • We already have a docker image for React todo list application on docker hub: https://hub.docker.com/repository/docker/kubekode/react-todo-list-app/general

  • Deploy a pod with the react todolist app image

  •   kubectl run todolistapp --image=kubekode/react-todo-list-app
  • Deploy a NodePort service for this pod.

  •   kubectl expose pod todolistapp --type=NodePort --port=80 --name=todolistapp-service
  • Check service is working or not

  •   minikube service todolistapp-service --url
  • Request the URL using curl to check it's working or not.

  •   curl <URL>
  • Now We want to access our application from outside.

  • Make sure you've enabled port 3000 for ingress traffic in AWS Instance security group.

  • Now Just use kubectl port-forward to forward the traffic from 3000 port to 80 port on our pod.

  •   kubectl port-forward svc/todolistapp-service 3000:80 --address 0.0.0.0 &

Now just paste your instance public IP in your browser and boom your application is deployed.