How it works...

This recipe showed you how to quickly create a CI/CD pipeline using a demo application running on a Kubernetes cluster.

In step 2 of the Deploying changes to a Kubernetes cluster on EKS recipe, we created a repository on AWS ECR to push our container images that were built by CircleCI. After a successful build, the images will be saved and accessible through the private registry location.

In step 6, when we run the pipeline, CircleCI will execute six jobs in order. The first job (build-and-push-image) will bring up a VM, check out our code, install any prerequisites, and build the image from the code. The second job (aws-eks/create-cluster) will create an EKS cluster using the CloudFormation stack and verify the cluster. The third job (deploy-application) will roll out the application. The fourth job (test-application) will get the external IP of the service using the kubectl get service demoapp command and connect to the service to validate the return. The service will return a page similar to the following:

Hello World! (Version info: 63d25fd14ef8dfb1c718cf81a815b36d80138d19, build date: 20190820224253)

Finally, the fifth (undeploy-application) and sixth (aws-eks/delete-cluster) jobs will remove the application and use CloudFormation again to destroy the EKS cluster, respectively.

With that, you've learned how to easily build your application using predefined container environments that have been deployed on CircleCI.