argocd 安装
2022-09-10
yaml 地址:https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/install.yaml
生产环境建议使用高可用安装:https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/ha/install.yaml
gitlhub地址:https://github.com/argoproj
官网链接:https://argo-cd.readthedocs.io/en/stable/getting_started/
官方文档链接:https://argo-cd.readthedocs.io/en/stable/operator-manual/installation/
具体安装步骤
1.1 直接部署;在网络好的地方执行,不然会有意想不到的结果😂 。
#### 该yaml绑定了 argocd ns ,如果需要安装到其他 ns 需要修改一下 ns
# 非高可用安装
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# 高可用安装
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/ha/install.yaml
```
- kind: ServiceAccount
name: argocd-application-controller
namespace: monitoring
....
- kind: ServiceAccount
name: argocd-server
namespace: monitoring
...
```
# 删除,参考链接:https://github.com/argoproj/argo-cd/tree/master/manifests/ha
# 该链接已经配置了 删除所需要的 yaml 直接执行就可以;
# 如果手动执行,使用如下方式
kubectl delete -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# 如果 -f 不能全部删除,记得手动删除,
# 手动删除时记得检查argo crd 资源是否删除干净;
kubectl patch crd/此处写CRD的名字 -p '{"metadata":{"finalizers":[]}}' --type=merge
kubectl patch crd/applications.argoproj.io -p '{"metadata":{"finalizers":[]}}' --type=merge
2. 修改argocd-server的ssl
由于 AWS 弹性负载均衡器正在执行 SSL 操作,我们需要通过禁用 TLS 在 HTTP(不安全)模式下启动 Argo CD。编辑部署以将标志添加到命令中:argocd-server --insecure
如下:
....
containers:
- command:
- argocd-server
- --insecure
....
3. 获取密码
# admin+上述密码登录
kubectl -n monitoring get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
4. 安装 argo cli
brew install argocd
5. 使用命令行登录 argocd
# 由于我做了ingress的映射,所以这里直接使用 argocd 的域名+端口登录,密码通过步骤 3 获得;用户名 admin
argocd login argocd.xxxx.com:443
argocd login argocd.nqspace.com:443
6. 创建个app
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
7. 手动同步应用程序
argocd app get guestbook
argocd app sync guestbook
8. argocd 添加集群
argocd cluster add #列出当前配置的上下文列表
argocd cluster add kubernetes-admin@kubernetes
9. 列出所有app和指定app
argocd app list
argocd app get guestbook