gitlab ci使用
Just a simple word,
只是一个简单的词,
it is how you do DevOps in Git.
这就是您在Git中进行DevOps的方式。
You store and manage your deployments in Git repositories. With this, you will leverage the version-control system for tracking changes in the deployments and coordinating work among infrastructure teams like how programmers do. When you have everything declaratively configured as a code in the Git system, this Git centralized workflow allows you to manage the infrastructure at scale, and set the stage for accelerating automation, i.e., “Git as a single source of truth”.
您可以在Git存储库中存储和管理部署。 这样,您将利用版本控制系统来跟踪部署中的更改,并在基础架构团队之间协调程序员的工作,从而协调工作。 当您在Git系统中将所有内容声明性地配置为代码时,此Git集中式工作流程将使您能够大规模管理基础架构,并为加速自动化打下基础,即“将Git作为单一事实来源”。
In this example, we are going to learn how to construct the GitOps workflow from end-to-end using GitLab CI, ArgoCD with Helm Chart. This series is based on the following components:
在此示例中,我们将学习如何使用带有Helm Chart的GitLab CI,ArgoCD端到端构建GitOps工作流程。 本系列基于以下组件:
GitLab CI Pipeline
亚搏体育app CI Pipeline
Kubernetes template using Helm chart
使用Helm图表的Kubernetes模板
Continuous Deployment using ArgoCD
使用ArgoCD进行连续部署
先决条件 (Prerequisites)
Before we begin, you need to have the Kubernetes cluster set up and running. If not, you can follow this instruction on my previous post on how to set up the K8s cluster using Kubespray.
在开始之前,您需要先设置并运行Kubernetes集群 。 如果没有,您可以按照我以前的文章中有关如何使用Kubespray设置K8s集群的说明进行操作 。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/6f96a23402d502a881f410b0f2d71140.png)
An ingress controller (e.g., Nginx) is also required to access the ArgoCD dashboard and deployed web application. Plus, through this guide, we are going to use the K8S Lens IDE as it helps to operate the cluster a lot easier.
还需要一个入口控制器 (例如Nginx )来访问ArgoCD仪表板和已部署的Web应用程序。 另外,通过本指南,我们将使用K8S Lens IDE,因为它有助于更轻松地操作群集。
1. ArgoCD (1. ArgoCD)
A declarative, GitOps continuous delivery tool for Kubernetes. argoproj.github.io/argo-cd
用于Kubernetes的声明性GitOps连续交付工具。 argoproj.github.io/argo-cd
1.1。 配置 (1.1. Setting Up)
Repositories: Helm Chart: argo/argo-cd, GitHub: argoproj/argo-helm/charts/argo-cd
仓库: Helm Chart: argo / argo-cd ,GitHub: argoproj / argo-helm / charts / argo-cd
$ kubectl create namespace argocd
$ helm repo add argo https://argoproj.github.io/argo-helm
For extra helm values configuration to access the server UI you have the following options:
要进行额外的头盔值配置以访问服务器UI,您可以使用以下选项:
kubectl port-forward service/argocd-server -n argocd 8080:443
then open the browser on http://localhost:8080 and accept the certificate.kubectl port-forward service/argocd-server -n argocd 8080:443
然后在http:// localhost:8080上打开浏览器并接受证书。Enable ingress in the values file
service.ingress
and add the annotation for ssl passthrough:在值文件
service.ingress
启用入口,并为ssl passthrough添加注释:
Note that I also add --insecure
flag to run with TLS disabled and set the installCRDs
value to false
to avoid nonexistant webhooks.
请注意,我还添加了--insecure
标志以在禁用TLS的情况下运行,并将installCRDs
值设置为false
以避免不存在的webhooks 。
installCRDs: false
server:
extraArgs:
- --insecure
service:
type: ClusterIP
ingress:
enabled: true
annotations:
- kubernetes.io/ingress.class: nginx
- nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
- nginx.ingress.kubernetes.io/ssl-passthrough: "true"
hosts:
- argocd.gitops.local
paths:
- /
kubectl create namespace argocd
helm repo add argo https://argoproj.github.io/argo-helm
# extra values file is based on this gist
# https://gist.github.com/pcrete/250896d4ff90ce2afa496c9f515b6be5
helm install argocd argo/argo-cd \
-f https://gist.githubusercontent.com/pcrete/250896d4ff90ce2afa496c9f515b6be5/raw/0057742a532e8dfd578c139385537cd39de07f03/argocd-values.yaml \
--version 2.6.0 \
--namespace argocd