云原生之旅 - 14)遵循 GitOps 实践的好工具 ArgoCD
前言
- 应用程序定义、配置和环境都是声明式的,并受版本控制
- 应用程序部署和生命周期管理都是自动化的、可审计的,并且易于理解。
本文使用 ArgoCD + Kustomize 实现自动化部署Kubernetes工作流。
## 本文同步发表于知乎 https://zhuanlan.zhihu.com/p/584881969
安装 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
brew install argocd
访问 Argo CD
Option 1: Service Type Load Balancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
Option 2: (Recommend) 使用 Gateway

# Ingress-Nginx installed first
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/force-ssl-redirect: "true"
ingress.kubernetes.io/ssl-redirect: "true"
kubernetes.io/ingress.class: nginx # If you encounter a redirect loop or are getting a 307 response code
# then you need to force the nginx ingress to connect to the backend using HTTPS.
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" # argocd backend using HTTPS # face to internet, recommend update to restrict access
nginx.ingress.kubernetes.io/whitelist-source-range: |
0.0.0.0/0 name: ingress-argocd
namespace: dmz
spec:
rules:
- host: argocd.wadexu.cloud
http:
paths:
- backend:
service:
name: argocd-ext-svc
port:
number: 8080
path: /
pathType: Prefix
tls:
- hosts:
- argocd.wadexu.cloud
secretName: tls-secret ---
# add externalName type svc in dmz namespace, so that Ingress (in dmz) can point to this svc in argocd ns
apiVersion: v1
kind: Service
metadata:
name: argocd-ext-svc
namespace: dmz
spec:
type: ExternalName
externalName: argocd-server.argocd.svc.cluster.local
ports:
- name: http
port: 8080
targetPort: 80
protocol: TCP
selector:
app.kubernetes.io/name: argocd-server
argocd_ingress.yaml
2. 使用 Emissary 参考 云原生之旅 - 9)云原生时代网关的后起之秀Envoy Proxy 和基于Envoy 的 Emissary Ingress
Option 3: 端口转发
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
# 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 也非常简单。详见官方文档。
## 本文同步发表于知乎 https://zhuanlan.zhihu.com/p/584881969
更多
- Kustomize applications (我的例子)
- Helm charts
- A directory of YAML/JSON/Jsonnet manifests, including Jsonnet.
- Any custom config management tool configured as a config management plugin
云原生之旅 - 14)遵循 GitOps 实践的好工具 ArgoCD的更多相关文章
- 云原生之旅 - 7)部署Terrform基础设施代码的自动化利器 Atlantis
前言 前面有几篇文章讲述了如何使用Terraform创建资源 (基础设施即代码 Terraform 快速入门, 使用 Terraform 创建 Kubernetes) 以及 Kubernetes时代的 ...
- 云原生之旅 - 5)Kubernetes时代的包管理工具 Helm
前言 上一篇文章 [基础设施即代码 使用 Terraform 创建 Kubernetes] 教会了你如何在Cloud上面建Kubernetes资源,那么本篇来讲一下如何在Kubernetes上面部署应 ...
- 云原生之旅 - 6)不能错过的一款 Kubernetes 应用编排管理神器 Kustomize
前言 相信经过前一篇文章的学习,大家已经对Helm有所了解,本篇文章介绍另一款工具 Kustomize,为什么Helm如此流行,还会出现 Kustomize?而且 Kustomize 自 kubect ...
- 云原生之旅 - 11)基于 Kubernetes 动态伸缩 Jenkins Build Agents
前言 上一篇文章 云原生之旅 - 10)手把手教你安装 Jenkins on Kubernetes 我们介绍了在 Kubernetes 上安装 Jenkins,本文介绍下如何设置k8s pod作为Je ...
- 公有云上构建云原生 AI 平台的探索与实践 - GOTC 技术论坛分享回顾
7 月 9 日,GOTC 2021 全球开源技术峰会上海站与 WAIC 世界人工智能大会共同举办,峰会聚焦 AI 与云原生两大以开源驱动的前沿技术领域,邀请国家级研究机构与顶级互联网公司的一线技术专家 ...
- 云原生之旅 - 8)云原生时代的网关 Ingress Nginx
前言 当我们在Kubernetes部署的服务需要暴露给外部用户使用时,有三种选择:LoadBalancer,NodePort, Ingress. LoadBalancer类型得结合各个Cloud Pr ...
- 云原生之旅 - 10)手把手教你安装 Jenkins on Kubernetes
前言 谈到持续集成工具就离不开众所周知的Jenkins,本文带你了解如何在 Kubernetes 上安装 Jenkins,后续文章会带你深入了解如何使用k8s pod 作为 Jenkins的build ...
- 给 K8s API “做减法”:阿里巴巴云原生应用管理的挑战和实践
作者 | 孙健波(天元) 阿里巴巴技术专家本文整理自 11 月 21 日社群分享,每月 2 场高质量分享,点击加入社群. 早在 2011 年,阿里巴巴内部便开始了应用容器化,当时最开始是基于 LXC ...
- 【云原生下离在线混部实践系列】深入浅出 Google Borg
Google Borg 是资源调度管理和离在线混部领域的鼻祖,同时也是 Kubernetes 的起源与参照,已成为从业人员首要学习的典范.本文尝试管中窥豹,简单从<Large-scale clu ...
- 腾讯云原生数据库TDSQL-C架构探索和实践
作为云原生技术先驱,腾讯云数据库内核团队致力于不断提升产品的可用性.可靠性.性能和可扩展性,为用户提供更加极致的体验.为帮助用户了解极致体验背后的关键技术点,本期带来腾讯云数据库专家工程师王鲁俊给大家 ...
随机推荐
- spark 读取Geomesa(Hbase)数据
package com.grady.geomesa import org.apache.hadoop.conf.Configuration import org.apache.spark.SparkC ...
- Flink SQL 子图复用逻辑分析
子图复用优化是为了找到SQL执行计划中重复的节点,将其复用,避免这部分重复计算的逻辑.先回顾SQL执行的主要流程 parser -> validate -> logical optimiz ...
- [Python]-sklearn.model_selection模块-处理数据集
拆分数据集train&test from sklearn.model_selection import train_test_split 可以按比例拆分数据集,分为train和test x_t ...
- Visual Studio 2022 Community 不完全攻略
0. 前言 建议结合视频阅读哦 Visual Studio 2022 Community 不完全攻略 有问题或者意见欢迎评论 ! 1. 下载&安装 Visual Studio Communit ...
- 我的Vue之旅、04 CSS媒体查询完全指南(Media Quires)
什么是SCSS Sass: Sass Basics (sass-lang.com) SCSS 是 CSS 的预处理器,它比常规 CSS 更强大. 可以嵌套选择器,更好维护.管理代码. 可以将各种值存储 ...
- 云原生分布式文件存储 MinIO 教程
文章转载自:https://mp.weixin.qq.com/s/_52kZ5jil1Cec98P5oozoA MinIO 提供开源.高性能.兼容 s3 的对象存储,为每个公共云.每个 Kuberne ...
- PAT (Advanced Level) Practice 1001 A+B Format 分数 20
Calculate a+b and output the sum in standard format -- that is, the digits must be separated into gr ...
- [题解] Atcoder Beginner Contest ABC 270 G Ex 题解
点我看题 G - Sequence in mod P 稍微观察一下就会发现,进行x次操作后的结果是\(A^xS+(1+\cdots +A^{x-1})B\).如果没有右边那一坨关于B的东西,那我们要求 ...
- 【持久层框架】- SpringData - JPA
SpringData - JPA 生命不息,写作不止 继续踏上学习之路,学之分享笔记 总有一天我也能像各位大佬一样 一个有梦有戏的人 @怒放吧德德 分享学习心得,欢迎指正,大家一起学习成长! JPA简 ...
- n维偏序 方法记录
题解 首先我们要对一个地点能否到达建立认知:一个地点能到达不仅仅是能从它的上一个点或上上个点跳到,而是能从第一个点开始跳一路跳到.就好比说,咱吃了6个包子吃饱了,但咱不能只付第6个包子的钱. 方法一: ...