官术网_书友最值得收藏!

  • Mastering Kubernetes
  • Gigi Sayfan
  • 471字
  • 2021-06-18 18:36:58

Continuous integration and deployment

Kubernetes is a great platform for running your microservice-based applications. But, at the end of the day, it is an implementation detail. Users, and often most developers, may not be aware that the system is deployed on Kubernetes. But Kubernetes can change the game and make things that were too difficult before possible.

In this section, we'll explore the CI/CD pipeline and what Kubernetes brings to the table. At the end of this section, you'll be able to design CI/CD pipelines that take advantage of Kubernetes properties such as easy scaling and development-production parity to improve the productivity and robustness of day-to-day development and deployment.

What is a CI/CD pipeline?

A CI/CD pipeline is a set of tools and steps that takes a set of changes by developers or operators that modify the code, data, or configuration of a system, tests them, and deploys them to production (and possibly other environments). Some pipelines are fully automated and some are semi-automated with human checks. In large organizations, there may be test and staging environments that changes are deployed to automatically, but release to production requires manual intervention. The following diagram depicts a typical pipeline:

Figure 1.4: Diagram representing CI/CD pipeline

It may be worth mentioning that developers can be completely isolated from production infrastructure. Their interface is just a Git workflow, where a good example is Deis Workflow (PaaS on Kubernetes, similar to Heroku).

Designing a CI/CD pipeline for Kubernetes

When your deployment target is a Kubernetes cluster, you should rethink some traditional practices. For starters, the packaging is different. You need to bake images for your containers. Reverting code changes is super easy and instantaneous by using smart labeling. It gives you a lot of confidence that, if a bad change slips through the testing net somehow, you'll be able to revert to the previous version immediately. But you want to be careful there. Schema changes and data migrations can't be automatically rolled back.

Another unique capability of Kubernetes is that developers can run a whole cluster locally. That takes some work when you design your cluster, but since the microservices that comprise your system run in containers, and those containers interact via APIs, it is possible and practical to do. As always, if your system is very data-driven, you will need to accommodate that and provide data snapshots and synthetic data that your developers can use.

There are many commercial CI/CD solutions that support Kubernetes, but there are also several Kubernetes-native solutions, such as Tekton, Argo CD, and Jenkins X.

A Kubernetes-native CI/CD solution runs inside your cluster, is specified using Kubernetes CRDs, and uses containers to execute the steps. By using a Kubernetes-native CI/CD solution, you get to benefit from Kubernetes managing and easily scaling your CI/CD pipelines, which is otherwise often a non-trivial task.

主站蜘蛛池模板: 仙游县| 磐安县| 紫金县| 醴陵市| 永和县| 咸阳市| 灵山县| 绥滨县| 拉萨市| 红安县| 建平县| 镇远县| 九龙城区| 剑川县| 萝北县| 龙海市| 南部县| 岱山县| 徐汇区| 沛县| 西乌珠穆沁旗| 乐亭县| 寿宁县| 瑞昌市| 沾化县| 安阳市| 临沭县| 临澧县| 贺州市| 防城港市| 赣州市| 深泽县| 宜兴市| 本溪| 祥云县| 上思县| 昔阳县| 策勒县| 绥宁县| 望都县| 康定县|