官方数据:https://argo-cd.readthedocs.io/en/stable/operator-manual/installation/
同时需要注意对应的 CRD 资源需要单独部署
[root@master01 ~]# cd /root/17
[root@master01 17]# mkdir -p crds && cd crds
[root@master01 crds]#
wget https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/crds/application-crd.yaml
[root@master01 crds]#
wget https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/crds/applicationset-crd.yaml
[root@master01 crds]#
wget https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/crds/appproject-crd.yaml
[root@master01 crds]#
wget https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/crds/kustomization.yaml
部署的文档可以参考官方的 latest 版本
[root@master01 17]# mkdir -p ha && cd ha && wget https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/ha/namespace-install.yaml
我们来看一下部署文件的结构:
[root@master01 17]# tree ./
./
├── crds
│ ├── application-crd.yaml
│ ├── applicationset-crd.yaml
│ ├── appproject-crd.yaml
│ └── kustomization.yaml
└── ha
└── namespace-install.yaml
2 directories, 5 files
部署环节我们可以分为 三步,部署 CRD 资源、创建 namespace、部署 workload 及相关配置。
首先我们定位到 crds 目录下面,直接部署对应的三个 crd文件用于创建对应的 crd资源。
[root@master01 ~]# cd /root/17/crds/
[root@master01 crds]# kubectl apply -f application-crd.yaml -f applicationset-crd.yaml -f appproject-crd.yaml
接着手动创建一个namespace,名字不一定为argocd,可以是你喜欢的任意值,但是注意后面指定的namespace 要和这里相同。
[root@master01 17]# kubectl create ns argocd
最后定位到 ha 目录下,直接部署argocd对应的全部工作负载,注意部署的时候指定namespace,否则会部署到默认的default namespace下。
[root@master01 ~]# cd /root/17/ha
# 修改国外镜像为国内镜像
[root@master01 ha]#
sed -i s#quay.io/argoproj/argocd:latest#registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15#g namespace-install.yaml
[root@master01 ha]#
sed -i s#ghcr.io/dexidp/dex:v2.41.1#registry.cn-hangzhou.aliyuncs.com/github_images1024/dex:v2.41.1#g namespace-install.yaml
[root@master01 ha]#
sed -i s#public.ecr.aws/docker/library/haproxy:2.6.17-alpine#registry.cn-hangzhou.aliyuncs.com/github_images1024/haproxy:2.6.17-alpine#g namespace-install.yaml
[root@master01 ha]#
sed -i s#public.ecr.aws/docker/library/redis:7.0.15-alpine#registry.cn-hangzhou.aliyuncs.com/github_images1024/redis:7.0.15-alpine#g namespace-install.yaml
# 验证
[root@master01 ha]# grep -ri "image:"
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/dex:v2.41.1
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/haproxy:2.6.17-alpine
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/haproxy:2.6.17-alpine
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/argocd:v2.6.15
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/redis:7.0.15-alpine
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/redis:7.0.15-alpine
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/redis:7.0.15-alpine
namespace-install.yaml: image: registry.cn-hangzhou.aliyuncs.com/github_images1024/redis:7.0.15-alpine
# 应用
[root@master01 ha]# kubectl apply -f namespace-install.yaml -n argocd
部署完成后检查部署的pod是否正常运行,此时所有的pod应该都在argocd这个namespace下。
[root@master01 ha]# cd /root/17/
[root@master01 17]# kubectl get pods -n argocd -o wide
最后检查对应的 svc 是否存在,同理此时所有的svc应该也都在 argocd 这个 namespace 下。
$ kubectl get svc -n argocd