Coder Social home page Coder Social logo

aws-docker-eks1's Introduction

Using Azure DevOps to dockerize and deploy an app to AWS EKS

What?

This project will assist you to use Azure DevOps pipeline(YAML) to containerize and deploy an application to AWS EKS(Elastic Kubernetes Service).

Why?

The aim was to help the developers automate application deployments with an end-end visible, traceable manner(when deployments fail, how do we know which build and image was used?)and how do we make less changes to the pipeline and just focus on the code. And obviously to show how awesome Azure DevOps isπŸ™‚

Prerequisites:-

β—‹ A running AWS EKS Cluster
β—‹ AWS ECR(Elastic Container Registry)
β—‹ AWS Kubernetes service connection
β—‹ AWS Services Connection
β—‹ An Azure DevOps account
β—‹ AWS Toolkit for Azure DevOps
β—‹ A Github account(or any Git based vcs)
β—‹ An application to be dockerized and deployed(free to use my sample)

Repo structure:-

1. Source folder: contains my python sample app
2. Root folder:
	β—‹ Dockerfile: used to dockerize my python app
	β—‹ App-manifest: a yaml Kubernetes deployment type(pod), application manifest
	β—‹ Azure-pipelines: This is a multi-stage yaml which contains all the steps required for the pipeline
	β—‹ Requirements: These are the application requirements

Usage:-

You are free to clone the repo and retrofit to your requirements, or you can copy any component but there are modifications required on the Azure-pipeline.

  1. AWS Kubernetes service connection

  2. AWS Services Connection

  3. Azure-pipeline

    • Ensure your repo name presents your app(E.G aws-docker-eks1) - easier to reference during automation

    • Build Stage

      • Authenticates to AWS ECR using my AWS service connection(AWS-Connection-1)
      • Builds and tags the docker image from the dockerfile
      • Pushes the image to AWS ECR
      • Copies the App-manifest.yaml to the staging directory for Release
    • Deploy Stage

      • Downloads the App-manifest.yaml for deployment
      • Authenticates and deploys the YAML file to the AWS EKS cluster

Things to note on the Pipeline and App-manifest

  • I am using the Azure DevOps Predefined variables[$(Build.BuildNumber), $(Build.Repository.Name)] for automation purposes(Image tagging on the YAML deployment & ECR repo)
  • I am using self-defined variables[$(AWS_REGION), $(ECR_ID)] for automation purposes.
  • I have also enabled Approvals for EKS deployment(continuous delivery)

Ok, so how do you use this for testing without changing a lot??

  • Meet the prerequisites
  • Change the self-defined variables
  • Change the (kubectl set) "arguments" line 104 on the Azure-pipeline file , to your own ECR repo mage
  • Change the "image" ref line 18 on the app-manifest, to your own ECR repo image

ECR image repo = $(ECR_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/siphiwemsibiaws-docker-eks1:$(Build.BuildNumber) replace with your ECR repo

This is the 1st MVP, proper blog to come soon if the need arises.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.