The contents of this repo is a python Flask application that in designed to be deployed on Kubernetes. This repository contains all the required resources to get this flask api up and running on AWS EKS. This readme describes how to deploy the solution, and a brief overview of resources that were used.
For deployment of the EKS cluster, an AWS maintained ClodFormation template is used. The template is designed to deploy into a new VPC that is created alongside other infrastructure required for supporting EKS. The following architecture diagram details at a high level the infrastructure deployed by the CFN stack.
The makefile is used for building and deploying this application and associated infrastructure. The makefile assumes that the tools that are called from the makefile are installed and configured on the machine from where it is ran. Several tools of note are listed below.
- AWS CLI
- Docker
- Kubernetes CLI - kubectl
In addition to the tools listed above there are several variable in the make file that will be specific to each user. they are listed below.
- docker_tag - the repository to push the built image to.
- aws_profile - the named profile which should be configured in the AWS cli.
The cfnparams.json file contains all the parameters for the cfn stack. Parameters are specific to each AWS account/region to which they are applied. This list is not exhaustive but covers most parameters of note.
- KeyPairName
- EKSPublicAccessEndpoint
- EKSClusterName
- KeyPairName
- AvailabilityZones
It will be necessary to configure kubectl to interact with the eks cluster. The makefile assumes this configuration has happened. The following tutorial gives a step by step instruction. https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
- building the docker image.
make build
- Push docker image to DockerHub
make push
- Deploy CFN stack
make infra-deploy
- Check deployment status of CFN stack. The stack can take 30-90 minutes to completely deploy. This command will return the status of the CFN stack and the status of the EKS cluster. Expected results are "CREATE_COMPLETE" & "ACTIVE". If that is not returned, further investigation or patience might be needed.
make test-env
- Deploy K8s
make deploy-api
- Test deployment
make test-deploy
- Delete and cleanup stack
make destroy