Kubernetes CI/CD管道 [英] Kubernetes CI/CD pipeline

查看:187
本文介绍了Kubernetes CI/CD管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司已决定过渡到基于微服务的体系结构.

My company has decided to transition to a micro/service based architecture.

在过去的几个月中,我们一直在进行大量研究,以确切了解此事物的架构是什么样的.

We have been doing a bunch of research for the last couple of months on exactly what the architecture of this thing is going to look like.

到目前为止,我们已经决定:

So far, we've settled on:

  • 用于服务开发的点网核心(尽管与语言无关是最终目标)

  • Dotnet core for service development (although being language agnostic is somewhat of an end goal)

Kafka用于消息代理

Kafka for message brokering

Docker

Kubernetes

Kubernetes

Ansible

我们有一个非常基本的概念工作证明,似乎已经与管理团队打了勾,并给予了极大的高兴.

We have a pretty basic proof of concept working, which seems to have ticked all the right boxes with the management team, and is an absolute joy to work with.

我的下一个任务是研究开发流程实际如何工作的选项.他们已经习惯了以CI/CD方式工作,并将其一些较新的产品使用Jenkins/Octopus Deploy.

My next task is to investigate options for how the development workflow is actually going to work. They are already used to working in a CI/CD manner, with some of their newer products using Jenkins/Octopus Deploy.

我的问题是:你们中的任何人在部署到Kubernetes集群时是否对建立CI/CD管道有任何建议?

My question is: Do any of you have any firm recommendations for setting up a CI/CD pipeline when deploying to a Kubernetes cluster?

必备物品清单为:

  • 多种环境,即集成,测试,UAT,分段,生产.

  • Multiple environments i.e. Integration, Test, UAT, Staging, Production.

一种手段,通过该手段,不同的业务部门可以唯一地处理针对不同环境的部署(开发只能推动集成,测试人员进入测试等).这可能是他们最大的要求-他们习惯使用八达通,并且喜欢它的处理方式.

A means through which different business units can uniquely handle deployments to different environments (development can only push to integration, tester into test, etc). This one is probably their biggest ask - they are used to working with Octopus, and they love the way it handles this.

只需单击一个按钮(或执行尽可能少的步骤)即可回滚/部署.

The ability to roll back / deploy at the click of a button (or with as few steps as possible).

我们最初将部署到我们自己的服务器上.

We would be deploying to our own servers initially.

过去两天我一直在研究期权,其中有很多.

I've spent the past couple of days looking in to options, of which there are many.

到目前为止,Jenkins Pipeline似乎是一个不错的开始. Spinnakar似乎也是一个不错的选择.我确实对Fabric8有所了解,虽然它提供了我所要问的许多内容,但似乎有点过分了.

So far, Jenkins Pipeline seems like it could be a great start. Spinnakar also seems like a solid choice. I did read a bit into Fabric8, and while it offers much of what I'm asking, it seems a bit like overkill.

推荐答案

如果您想使用Jenkins,管道确实是您的最佳选择.我们的设置几乎可以完成您想要的一切,所以让我解释一下如何设置它.

If you want to use Jenkins, Pipelines are indeed the way to go. Our setup does pretty much what you want, so let me explain how we set it up.

我们使用安装了dockerkubectl的Jenkins代理.该代理首先构建docker容器并将其推送到我们的docker注册表中.然后它将在各个阶段调用kubectl,以部署到我们的测试,验收和生产集群.

We use a Jenkins agent that has docker and kubectl installed. This agent first builds the docker container and pushes it to our docker registry. It will then call kubectl in various stages to deploy to our testing, acceptance and production clusters.

不同的业务部门:您可以在管道中使用

Different business units: in a Pipeline you can use an input step to ask whether the Pipeline should proceed or not. You can specify who may press the button, so this is how you could solve the deployment to different clusters. (Ideally, when you get to CD, people will realize that pressing the button several times per day is silly and they'll just automate the entire deployment.)

回滚:我们依赖于Kubernetes的回滚系统.

Rollback: we rely on Kubernetes's rollback system for this.

凭据:我们直接使用Ansible为该Jenkins代理提供了不同的Kubernetes凭据.

Credentials: we provision the different Kubernetes credentials using Ansible directly to this Jenkins agent.

为减少代码重复,我们引入了共享的 Jenkins Pipeline库 ,因此每个(微)服务都以标准化方式与所有Kubernetes集群通信.

To reduce code duplication, we introduced a shared Jenkins Pipeline library, so each (micro)service talks to all Kubernetes clusters in a standardized way.

请注意,我们使用普通的Jenkins,Docker和Kubernetes.可能会有大量的软件可以进一步简化此过程,所以让我们留待其他答案.

Note that we use plain Jenkins, Docker and Kubernetes. There is likely tons of software to further ease this process, so let's leave that open for other answers.

这篇关于Kubernetes CI/CD管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆