安装argocd
kubectl create namespace argocdkubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
暴露argocd ui
kubectl patch service -n argocd argocd-server -p '{"spec": {"type": "NodePort"}}'
获取admin登陆密码
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
cli端安装
https://github.com/argoproj/argo-cd/releases/download/v2.2.5/argocd-linux-amd64mv argocd-linux-amd64 /usr/local/bin/argocd
cli端操作 登陆 argocd login ArgoCD_Address:Port
argocd login 192.168.8.68:30004
.从git仓库创建一个Application 创建一个test-guesT app,指定仓库地址、应用路径、目标apiserver地址、目标namespace
argocd app create test-guest --repo http://git.rapha.top/jbjb/argo-cd.git --path test00 --dest-server https://kubernetes.default.svc --dest-namespace default
列出所有app和指定app
argocd app listargocd app get test-guest
手动从git仓库同步指定app
argocd app sync test-guest
登录UI
删除
argocd app delete test-guest
注意!!!删除的话pod也跟着删除更多指令
https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd_app/
添加默认一个repo解决需要用户密码登录的git仓库
argocd repo add http://git.rapha.top/jbjb/test01.git --username admin --password 123456
再添加需要发布的项目像之前一样
argocd app create test01 --repo http://git.rapha.top/jbjb/test01.git --path test --dest-server https://kubernetes.default.svc --dest-namespace default
查看
[root@gitlan ~]# argocd repo listTYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECTgit http://git.rapha.top/jbjb/test01.git false false false true Successful
手动同步
#查看app[root@gitlan ~]# argocd app listNAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGETtest01 https://kubernetes.default.svc default default OutOfSync Missing
删除一个repo源
[root@gitlan ~]# argocd repo listTYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECTgit http://git.rapha.top/jbjb/rook-ceph false false false true Successful[root@gitlan ~]# argocd repo rm http://git.rapha.top/jbjb/rook-cephRepository 'http://git.rapha.top/jbjb/rook-ceph' removed[root@gitlan ~]# argocd repo listTYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECT
更多命令参考链接: 点击官网连接.