部署argocd
https://github.com/argoproj/argo-cd/releases
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.9.1/manifests/install.yaml
官网
https://argo-cd.readthedocs.io/en/stable/
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.9.1/manifests/install.yaml
使用ingress对外开放,部署ingress
root@k8s-master01:~/learning-jenkins-cicd/09-argocd-and-rollout/01-ingress-argocd-and-rollouts# kubectl apply -f ingress-argocd.yamlroot@k8s-master01:~/learning-jenkins-cicd/09-argocd-and-rollout/01-ingress-argocd-and-rollouts# kubectl get ingress -n argocd
NAME CLASS HOSTS ADDRESS PORTS AGE
argocd-server-ingress nginx argocd.magedu.com 192.168.1.201 80 5m2s添加解析
192.168.1.201 argocd.magedu.com
访问
下载argocd命令行工具并安装
https://github.com/argoproj/argo-cd/releases/download/v2.9.1/argocd-linux-amd64
root@k8s-master01:~# install -m 755 argocd-linux-amd64 /usr/local/bin/argocd
root@k8s-master01:~# ls -l /usr/local/bin/argocd
-rwxr-xr-x 1 root root 153566606 Nov 19 16:58 /usr/local/bin/argocd
官方文档登录argo-cd
https://argo-cd.readthedocs.io/en/stable/getting_started/
使用argocd检索密码
root@k8s-master01:~# argocd admin initial-password -n argocd
k905LK-zbaZLAtHU
This password must be only used for first time login. We strongly recommend you update the password using argocd account update-password
.
默认用户名admin
更新密码为12345678
root@k8s-master01:~# argocd account update-password
*** Enter password of currently logged in user (admin):
*** Enter new password for user admin:
*** Confirm new password for user admin:
Password updated
Context ‘10.111.216.35’ updated
gitlab创建新仓库Spring Boot HelloWorld deploy
克隆
root@jenkins:~# git clone http://192.168.1.50/root/spring-boot-helloworld-deploy.git
拷贝部署文件到spring-boot-helloworld-deploy并修改镜像为harbor创建的镜像
root@jenkins:~# cp spring-boot-helloWorld/rollouts/ spring-boot-helloWorld/deploy/ spring-boot-helloworld-deploy/ -rp
root@jenkins:~# cd spring-boot-helloworld-deploy/
root@jenkins:~/spring-boot-helloworld-deploy# ls
README.md deploy rollouts
推送
root@jenkins:~/spring-boot-helloworld-deploy# git push origin
Username for ‘http://192.168.1.50’: roo
argocd 创建application
填写gitlab 配置的仓库地址
分支
部署到那个集群,默认https://kubernetes.default.svc就是argocd所在的集群
部署到那个命名空间
添加后就会自动部署
argocd Rollout 可以查看