Kubernetes集群中部署Argo CD持续部署

2022-03-23 15:51:15 浏览数 (2)

K8s集群中部署Argo CD持续部署

创建argocd命名空间

代码语言:javascript复制
kubectl create namespace argocd

安装资源

代码语言:javascript复制
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
代码语言:javascript复制
customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io created
serviceaccount/argocd-application-controller created
serviceaccount/argocd-dex-server created
serviceaccount/argocd-server created
role.rbac.authorization.k8s.io/argocd-application-controller created
role.rbac.authorization.k8s.io/argocd-dex-server created
role.rbac.authorization.k8s.io/argocd-server created
clusterrole.rbac.authorization.k8s.io/argocd-application-controller created
clusterrole.rbac.authorization.k8s.io/argocd-server created
rolebinding.rbac.authorization.k8s.io/argocd-application-controller created
rolebinding.rbac.authorization.k8s.io/argocd-dex-server created
rolebinding.rbac.authorization.k8s.io/argocd-server created
clusterrolebinding.rbac.authorization.k8s.io/argocd-application-controller created
clusterrolebinding.rbac.authorization.k8s.io/argocd-server created
configmap/argocd-cm created
configmap/argocd-gpg-keys-cm created
configmap/argocd-rbac-cm created
configmap/argocd-ssh-known-hosts-cm created
configmap/argocd-tls-certs-cm created
secret/argocd-secret created
service/argocd-dex-server created
service/argocd-metrics created
service/argocd-redis created
service/argocd-repo-server created
service/argocd-server-metrics created
service/argocd-server created
deployment.apps/argocd-application-controller created
deployment.apps/argocd-dex-server created
deployment.apps/argocd-redis created
deployment.apps/argocd-repo-server created
deployment.apps/argocd-server created

查看argocd命名空间下的所有资源

代码语言:javascript复制
[root@k8s-master ~]# kubectl get all -n argocd
代码语言:javascript复制
NAME                                                 READY   STATUS              RESTARTS   AGE
pod/argocd-application-controller-5db8c6f8f9-r22c9   0/1     ContainerCreating   0          11s
pod/argocd-dex-server-84b5cbfbc9-w2zmc               0/1     Init:0/1            0          11s
pod/argocd-redis-7c7c79dcd9-6ghw7                    0/1     ContainerCreating   0          11s
pod/argocd-repo-server-5fb9cbb945-k594b              0/1     ContainerCreating   0          10s
pod/argocd-server-8d8cb6488-jmqtc                    0/1     ContainerCreating   0          10s

NAME                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/argocd-dex-server       ClusterIP   10.111.26.128    <none>        5556/TCP,5557/TCP,5558/TCP   11s
service/argocd-metrics          ClusterIP   10.105.248.214   <none>        8082/TCP                     11s
service/argocd-redis            ClusterIP   10.101.110.209   <none>        6379/TCP                     11s
service/argocd-repo-server      ClusterIP   10.106.143.32    <none>        8081/TCP,8084/TCP            11s
service/argocd-server           ClusterIP   10.99.143.48     <none>        80/TCP,443/TCP               11s
service/argocd-server-metrics   ClusterIP   10.101.34.55     <none>        8083/TCP                     11s

NAME                                            READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/argocd-application-controller   0/1     1            0           11s
deployment.apps/argocd-dex-server               0/1     1            0           11s
deployment.apps/argocd-redis                    0/1     1            0           11s
deployment.apps/argocd-repo-server              0/1     1            0           10s
deployment.apps/argocd-server                   0/1     1            0           10s

NAME                                                       DESIRED   CURRENT   READY   AGE
replicaset.apps/argocd-application-controller-5db8c6f8f9   1         1         0       11s
replicaset.apps/argocd-dex-server-84b5cbfbc9               1         1         0       11s
replicaset.apps/argocd-redis-7c7c79dcd9                    1         1         0       11s
replicaset.apps/argocd-repo-server-5fb9cbb945              1         1         0       10s
replicaset.apps/argocd-server-8d8cb6488                    1         1         0       10s

稍等片刻,就会完成

代码语言:javascript复制
[root@k8s-master ~]# kubectl get all -n argocd
代码语言:javascript复制
NAME                                                 READY   STATUS    RESTARTS   AGE
pod/argocd-application-controller-5db8c6f8f9-r22c9   1/1     Running   0          13h
pod/argocd-dex-server-84b5cbfbc9-w2zmc               1/1     Running   0          13h
pod/argocd-redis-7c7c79dcd9-6ghw7                    1/1     Running   0          13h
pod/argocd-repo-server-5fb9cbb945-k594b              1/1     Running   0          13h
pod/argocd-server-8d8cb6488-jmqtc                    1/1     Running   0          13h

NAME                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/argocd-dex-server       ClusterIP   10.111.26.128    <none>        5556/TCP,5557/TCP,5558/TCP   13h
service/argocd-metrics          ClusterIP   10.105.248.214   <none>        8082/TCP                     13h
service/argocd-redis            ClusterIP   10.101.110.209   <none>        6379/TCP                     13h
service/argocd-repo-server      ClusterIP   10.106.143.32    <none>        8081/TCP,8084/TCP            13h
service/argocd-server           NodePort    10.99.143.48     <none>        80:30706/TCP,443:31741/TCP   13h
service/argocd-server-metrics   ClusterIP   10.101.34.55     <none>        8083/TCP                     13h

NAME                                            READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/argocd-application-controller   1/1     1            1           13h
deployment.apps/argocd-dex-server               1/1     1            1           13h
deployment.apps/argocd-redis                    1/1     1            1           13h
deployment.apps/argocd-repo-server              1/1     1            1           13h
deployment.apps/argocd-server                   1/1     1            1           13h

NAME                                                       DESIRED   CURRENT   READY   AGE
replicaset.apps/argocd-application-controller-5db8c6f8f9   1         1         1       13h
replicaset.apps/argocd-dex-server-84b5cbfbc9               1         1         1       13h
replicaset.apps/argocd-redis-7c7c79dcd9                    1         1         1       13h
replicaset.apps/argocd-repo-server-5fb9cbb945              1         1         1       13h
replicaset.apps/argocd-server-8d8cb6488                    1         1         1       13h

修改Service的Cluster更改为NodePort

代码语言:javascript复制
[root@k8s-master ~]# kubectl edit -n argocd svc argocd-server
service/argocd-server edited

查看argocd的service

代码语言:javascript复制
[root@k8s-master ~]# kubectl get svc -n argocd
NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
argocd-dex-server       ClusterIP   10.111.26.128    <none>        5556/TCP,5557/TCP,5558/TCP   87s
argocd-metrics          ClusterIP   10.105.248.214   <none>        8082/TCP                     87s
argocd-redis            ClusterIP   10.101.110.209   <none>        6379/TCP                     87s
argocd-repo-server      ClusterIP   10.106.143.32    <none>        8081/TCP,8084/TCP            87s
argocd-server           NodePort    10.99.143.48     <none>        80:30706/TCP,443:31741/TCP   87s
argocd-server-metrics   ClusterIP   10.101.34.55     <none>        8083/TCP                     87s

查看登录密码---默认账户为:admin

代码语言:javascript复制
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2

0 人点赞