简体   繁体   English

使用gitlab的CI / CD(在线)到kubernetes集群(动态)

[英]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.

相关问题 如何将Azure AKS Kubernetes Cluster自签名CA添加到GitLab CI / CD Kubernetes集成? - How to add an Azure AKS Kubernetes Cluster self-signed CA to GitLab CI/CD Kubernetes integration? 通过 Gitlab CI/CD 将 Next JS 应用程序部署到 Kube.netes 集群时,ENV_VARS“未定义”: - ENV_VARS "undefined" when deploying Next JS app through Gitlab CI/CD to a Kubernetes cluster: GitLab CI/CD、Kubernetes 和私有卷 - GitLab CI/CD, Kubernetes and, Private Volumes Kubernetes集群上的Gitlab CI(Openstack) - Gitlab CI on Kubernetes Cluster (Openstack) 我在集群内使用 GItLab CI/CD kubernetes 执行程序运行作业时出错 - I have an error while running jobs with GItLab CI/CD kubernetes executor within the cluster 如何使用Kubernetes和Gitlab CI / CD在Google Cloud Platform中部署登台? - How to deploy staging in Google Cloud Platform with Kubernetes and Gitlab CI/CD? Gitlab 使用 Kube.netes 代理和私有容器注册表的 CI/CD - Gitlab CI/CD using Kubernetes agent and the private container registry 如何为私有 GKE 集群启用 Gitlab CI/CD? - How to enable Gitlab CI/CD for Private GKE cluster? Gitlab CI 运行器连接到私有 AWS 子网中的 Kubernetes 集群 - Gitlab CI runners connection to Kubernetes cluster in private AWS subnet 如何配置我的 Kubernetes 集群以使用 Gitlab CI? - How do I configure my Kubernetes cluster to work with Gitlab CI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM