ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

云原生之旅 - 14)遵循 GitOps 实践的好工具 ArgoCD

2022-11-20 12:11:50  阅读:279  来源: 互联网

标签:Ansible 构建 Tower CockroachDB 控制平面 限制 系统 创建


前言

Argo CD 是一款基于 kubernetes 的声明式的Gitops 持续部署工具。
  1. 应用程序定义、配置和环境都是声明式的,并受版本控制
  2. 应用程序部署和生命周期管理都是自动化的、可审计的,并且易于理解。

本文使用 ArgoCD + Kustomize 实现自动化部署Kubernetes工作流。

安装 Argo CD

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

 

命令行工具 Argo CD CLI


MacOS 安装
1 brew install argocd

  

访问 Argo CD

Option 1: Service Type Load Balancer

You can change Service Type to Load Balancer 
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

  

Option 2: (Recommend) 使用 Gatewa

Option 3: 端口转发

运行下面命令然后本地浏览器访问 `https://localhost:8080`
kubectl port-forward svc/argocd-server -n argocd 8080:443

 

The initial password for the admin account is auto-generated and stored as clear text in the field password in a secret named argocd-initial-admin-secret in your Argo CD installation namespace. You can simply retrieve this password using kubectl
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

域名取决于你在gateway里面的配置,Login now

argocd login https://argocd.wadexu.cloud

如果是端口转发,参考如下命令

kubectl port-forward svc/argocd-server -n argocd 8080:443
argocd login https://localhost:8080 --username admin --password <repalce_me> 

更改密码

argocd account update-password

 

注册 external Cluster


(Optional) 这一步是为了deploy到到外部的cluster,如果仅仅deploy到和Argo CD一起的cluster 则使用 https://kubernetes.default.svc
# list context
kubectx

argocd cluster add xxx_context

 

创建 Application

Creating Apps Via CLI

kubectl config set-context --current --namespace=argocd

argocd app create my-app --repo https://github.com/wadexu007/learning_by_doing.git --path Kustomize/demo-manifests/services/demo-app/dev --dest-server https://kubernetes.default.svc --dest-namespace demo

 

Sync (Deploy) Application

Syncing via CLI

argocd app get my-app
argocd app sync my-app

 

通过UI 创建和Sync Application 也非常简单。

更多

Argo CD supports several different ways in which Kubernetes manifests can be defined:
  • Kustomize applications (我的例子)
  • Helm charts
  • A directory of YAML/JSON/Jsonnet manifests, including Jsonnet.
  • Any custom config management tool configured as a config management plugin

标签:Ansible,构建,Tower,CockroachDB,控制平面,限制,系统,创建
来源:

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有