End-to-end walk-through of the delivery pipeline 

The following diagram is our CD flow based on the three services mentioned earlier:

The workflow for code integration is as follows:

  1. Code is committed to a repository on GitHub.
  2. The commit triggers a build job on Travis CI:
    • A Docker image will be built.
    • To ensure that the quality of the build is solid and ready to be integrated, different levels of tests are usually performed at this stage on the CI server. Furthermore, as running an application stack with Docker Compose or Kubernetes is easier than ever, running tests involving many components in a build job is also possible.
  3. The verified image is tagged with identifiers and pushed to Docker Hub.

As for the deployment in Kubernetes, this can be as simple as updating the image path in a template and then applying the template to a production cluster, or as complex as a series of operations including traffic distribution and canary deployment. In our example, a rollout starts from manually publishing a new Git SemVer tag, and the CI script repeats the same flow as in the integration part until the image pushing step. As a CI server sometimes may not be able to touch the production environment, we put an agent inside our cluster to watch and apply the changes in the configuration branch.

A dedicated config repository is a popular pattern for segregating an application and its infrastructure. There are many Infrastructure as Code (IaC) tools that help us to express infrastructure and their states in a way that can be recorded in a version control system. Additionally, by tracking everything in a version control system, we can translate every change made to the infrastructure into Git operations. For the sake of simplicity, we use another branch in the same repository for the config changes.

Once the agent observes the change, it pulls the new template and updates the corresponding controller accordingly. Finally, the delivery is finished after the rolling update process of Kubernetes ends.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset