[英]CI/CD with gitlab (online) to kubernetes cluster (kismatic)
I have setup k8s cluster using kismatic and created CI/CD pipeline in gitlab. 我已经使用kismatic设置了k8s集群,并在gitlab中创建了CI / CD管道。 K8s cluster is in aws ec2 single instance.
K8s群集位于AWS ec2单实例中。 So how to connect gitlab with k8s cluster + helm to deploy the images.
那么如何将gitlab与k8s cluster + helm连接以部署映像。
All newer versions of k8 have rbac enabled so the token runner will ultimately be using will have to be clusterbinding or you won't be able to deploy outside of the namespace of the token 所有较新的k8版本都启用了rbac,因此令牌运行程序最终将要使用的将是集群绑定的,否则您将无法在令牌的名称空间之外进行部署
1) If you use a runner with persistent state such as an ec2 instance then you can just copy over your working kubeconfig found in ~/.kube/config 1)如果您使用具有持久状态的运行器(例如ec2实例),则可以复制〜/ .kube / config中的工作kubeconfig
2) You can deploy a runner into kubernetes. 2)您可以将运行程序部署到kubernetes中。 This is very simple, they have a helm chart for a runner.
这很简单,他们有一个跑步者的舵图。 You'll need to clusterbind the service account the runner is deployed to, chart doesn't do it for you
您需要将奔跑者部署到的服务帐户进行集群绑定,Chart不能为您完成
3) If you're using their runners you can base64 kubeconfig into a CI variable and create the file as a before script 3)如果您正在使用他们的跑步者,则可以将base64 kubeconfig转换为CI变量并将文件创建为before脚本
4) Integrate kubernetes the gitlab way (it's on the UI) then gitlab will inject a kubeconfig into jobs that have an environment section. 4)以gitlab方式集成kubernetes(在UI上),然后gitlab会将kubeconfig注入具有环境部分的作业中。 This is what I'm doing, integration is a bit rough but if you would like to have feature branch sandbox deployments there's a way to have a stage to teardown after merge so it's quite nice however I'd skip their add-on buttons such as helm and ingress and do that myself instead as you don't get to tweak any options
这就是我正在做的事情,集成有点粗糙,但是如果您想进行功能分支沙箱部署,可以在合并后有一个拆卸阶段的方法,所以这很好,但是我跳过了它们的附加按钮,例如掌舵和进入,自己动手做,因为您无需调整任何选项
Other than option 1; 除了选项1; you then use a helm or kubectl image for your deploy jobs
然后,您可以使用helm或kubectl映像进行部署作业
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.