This app displays any requested URI as string and also shows IP address of machine where it's running. If the URI is /index.html this static page will be displayed.
- awscli
- docker
- kubectl
- terraform
- wget
AWS account with these IAM permissions
$ cd terraform
$ terraform init
$ terraform plan
$ terraform apply📝 Note: terraform apply with -auto-approve can be used as well
$ aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)First of all we have to build docker image and push it somewhere to public or configured private docker registry. Pushing changes to this repository will also build and push redhatua/echo image to dockerhub which also can be used as well.
$ export DOCKER_TAG=mytag
$ docker build -t $DOCKER_TAG .After build image can be tested locally -v <path_to_index_file>:/app/index.html can be added to mount custom index file
$ docker run --rm -ti -p 8080:8080 $DOCKER_TAGAlso don't forget to replace image tag in kubernetes/deployment.yaml
$ sed -i 's/redhatua\/echo/'"$DOCKER_TAG"'/g' kubernetes/deployment.yamlAnd we finally can deploy it to cluster.
$ cd kubernetes
$ kubectl -f deployment.yaml apply💡 Tip: getting exposed deployment URL
$ kubectl get svc | grep 'echo-app-service' | awk -v prefix="http://" '{ print prefix $4 }'$ cd kubernetes
$ kubectl -f deployment.yaml delete$ cd terraform
$ terraform destroy -auto-approve