官网
https://github.com/argoproj/argo-cd/releases/tag/v2.5.2
我部署的事Non-HA版本
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.5.2/manifests/install.yaml
下载Argocd CLI
[root@master ~]# wget https://github.com/argoproj/argo-cd/releases/download/v2.5.2/argocd-linux-amd64
[root@master ~]# cp argocd-linux-amd64 /usr/bin/argocd
[root@master ~]# chmod +x /usr/bin/argocd
[root@master ~]# argocd --help
查看创建的资源
[root@master ~]# kubectl get pods -n argocd
NAME READY STATUS RESTARTS AGE
argocd-application-controller-0 1/1 Running 0 5m40s
argocd-applicationset-controller-85dd79b7f7-xhf4j 1/1 Running 0 5m38s
argocd-dex-server-75bc5d74cf-87bf8 1/1 Running 0 5m38s
argocd-notifications-controller-c75bcc7d4-zfkqb 1/1 Running 0 5m38s
argocd-redis-79c755c747-xb9fb 1/1 Running 0 5m38s
argocd-repo-server-799cd5cb99-cbsz4 1/1 Running 0 5m32s
argocd-server-7c64469857-t2c82 1/1 Running 0 5m37s
[root@master ~]# kubectl get svc -n argocd
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argocd-applicationset-controller ClusterIP 10.103.232.45 <none> 7000/TCP,8080/TCP 6m9s
argocd-dex-server ClusterIP 10.97.66.179 <none> 5556/TCP,5557/TCP,5558/TCP 6m9s
argocd-metrics ClusterIP 10.102.85.142 <none> 8082/TCP 6m8s
argocd-notifications-controller-metrics ClusterIP 10.111.197.81 <none> 9001/TCP 6m8s
argocd-redis ClusterIP 10.105.0.205 <none> 6379/TCP 6m8s
argocd-repo-server ClusterIP 10.108.12.65 <none> 8081/TCP,8084/TCP 6m8s
argocd-server ClusterIP 10.111.81.151 <none> 80/TCP,443/TCP 6m8s
argocd-server-metrics ClusterIP 10.102.35.24 <none> 8083/TCP 6m8s
我们用istio-ingressgateway将argocd的服务暴露出去
[root@master ~]# kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 10.110.219.229 10.211.55.30 15021:30657/TCP,80:30216/TCP,443:30877/TCP 16d
istiod ClusterIP 10.105.252.240 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 16d
[root@master argocd]# kubectl apply -f 02-argocd-dashboard-virtualservice.yaml
gateway.networking.istio.io/argocd-dashboard-gateway created
virtualservice.networking.istio.io/argocd-dashboard-virtualservice created
[root@master argocd]# cat 02-argocd-dashboard-virtualservice.yaml
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: argocd-dashboard-gateway
namespace: istio-system
spec:
selector:
app: istio-ingressgateway
servers:
- hosts:
- "argocd.yang.com"
port:
number: 80
name: http
protocol: HTTP
tls:
httpsRedirect: true
- hosts:
- "argocd.yang.com"
port:
number: 443
name: https
protocol: HTTPS
tls:
mode: PASSTHROUGH
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: argocd-dashboard-virtualservice
namespace: argocd
spec:
hosts:
- "argocd.yang.com"
gateways:
- istio-system/argocd-dashboard-gateway
tls:
- match:
- port: 443
sniHosts:
- argocd.yang.com
route:
- destination:
host: argocd-server
port:
number: 443
做好域名解析,用浏览器访问
查看密码,账号admin 密码ln5sHFJmkPcqwueV直接登陆
[root@master argocd]# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
ln5sHFJmkPcqwueV
修改密码,修改好之后 在网页端试试
[root@master argocd]# argocd login argocd.yang.com
WARNING: server certificate had error: x509: certificate is valid for localhost, argocd-server, argocd-server.argocd, argocd-server.argocd.svc, argocd-server.argocd.svc.cluster.local, not argocd.yang.com. Proceed insecurely (y/n)? y
Username: admin
Password:
'admin:login' logged in successfully
Context 'argocd.yang.com' updated
[root@master argocd]# 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 'argocd.yang.com' updated
新建一个app
进入到新建的app中
点击SYNC
查看SYNC过程
部署完成
也可以查看Events喝Logs
查看资源
[root@master argocd]# kubectl get applications -n argocd
NAME SYNC STATUS HEALTH STATUS
guestbook Synced Healthy
[root@master argocd]# argocd app list
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
argocd/guestbook https://kubernetes.default.svc guestbook default Synced Healthy <none> <none> https://gitee.com/mageedu/argocd-example-apps.git guestbook HEAD
[root@master argocd]# argocd app get guestbook
Name: argocd/guestbook
Project: default
Server: https://kubernetes.default.svc
Namespace: guestbook
URL: https://argocd.yang.com/applications/guestbook
Repo: https://gitee.com/mageedu/argocd-example-apps.git
Target: HEAD
Path: guestbook
SyncWindow: Sync Allowed
Sync Policy: <none>
Sync Status: Synced to HEAD (015edec)
Health Status: Healthy
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service guestbook guestbook-ui Synced Healthy service/guestbook-ui unchanged
apps Deployment guestbook guestbook-ui Synced Healthy deployment.apps/guestbook-ui unchanged
开启SYNC POLICY
修改同步策略
查看guestbook资源
[root@master argocd]# argocd app manifests guestbook
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/instance: guestbook
name: guestbook-ui
namespace: guestbook
spec:
ports:
- port: 80
targetPort: 80
selector:
app: guestbook-ui
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: guestbook
name: guestbook-ui
namespace: guestbook
spec:
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app: guestbook-ui
template:
metadata:
labels:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
name: guestbook-ui
ports:
- containerPort: 80
[root@master argocd]# kubectl get application guestbook -o yaml -n argocd
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
creationTimestamp: "2022-11-11T10:18:57Z"
generation: 37
name: guestbook
namespace: argocd
resourceVersion: "1536140"
uid: 9d37a35a-703d-4ce5-8df2-8c2ae88b3225
spec:
destination:
namespace: guestbook
server: https://kubernetes.default.svc
project: default
source:
directory:
jsonnet:
tlas:
- name: ""
value: ""
path: guestbook
repoURL: https://gitee.com/mageedu/argocd-example-apps.git
targetRevision: HEAD
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
status:
health:
status: Healthy
history:
- deployStartedAt: "2022-11-11T10:26:08Z"
deployedAt: "2022-11-11T10:26:12Z"
id: 0
revision: 015edec9578d1eff5d2703ca0b7dc119bddf3a7d
source:
directory:
jsonnet:
tlas:
- name: ""
value: ""
path: guestbook
repoURL: https://gitee.com/mageedu/argocd-example-apps.git
targetRevision: HEAD
- deployStartedAt: "2022-11-11T11:02:16Z"
deployedAt: "2022-11-11T11:02:16Z"
id: 1
revision: 015edec9578d1eff5d2703ca0b7dc119bddf3a7d
source:
directory:
jsonnet:
tlas:
- name: ""
value: ""
path: guestbook
repoURL: https://gitee.com/mageedu/argocd-example-apps.git
targetRevision: HEAD
operationState:
finishedAt: "2022-11-11T11:02:16Z"
message: successfully synced (all tasks run)
operation:
initiatedBy:
username: admin
retry: {}
sync:
revision: 015edec9578d1eff5d2703ca0b7dc119bddf3a7d
syncOptions:
- CreateNamespace=true
syncStrategy:
hook: {}
phase: Succeeded
startedAt: "2022-11-11T11:02:16Z"
syncResult:
resources:
- group: ""
hookPhase: Running
kind: Service
message: service/guestbook-ui unchanged
name: guestbook-ui
namespace: guestbook
status: Synced
syncPhase: Sync
version: v1
- group: apps
hookPhase: Running
kind: Deployment
message: deployment.apps/guestbook-ui unchanged
name: guestbook-ui
namespace: guestbook
status: Synced
syncPhase: Sync
version: v1
revision: 015edec9578d1eff5d2703ca0b7dc119bddf3a7d
source:
directory:
jsonnet:
tlas:
- name: ""
value: ""
path: guestbook
repoURL: https://gitee.com/mageedu/argocd-example-apps.git
targetRevision: HEAD
reconciledAt: "2022-11-11T11:26:39Z"
resources:
- health:
status: Healthy
kind: Service
name: guestbook-ui
namespace: guestbook
status: Synced
version: v1
- group: apps
health:
status: Healthy
kind: Deployment
name: guestbook-ui
namespace: guestbook
status: Synced
version: v1
sourceType: Directory
summary:
images:
- gcr.io/heptio-images/ks-guestbook-demo:0.2
sync:
comparedTo:
destination:
namespace: guestbook
server: https://kubernetes.default.svc
source:
directory:
jsonnet:
tlas:
- name: ""
value: ""
path: guestbook
repoURL: https://gitee.com/mageedu/argocd-example-apps.git
targetRevision: HEAD
revision: 015edec9578d1eff5d2703ca0b7dc119bddf3a7d
status: Synced
删除资源
[root@master argocd]# argocd app delete guestbook
Are you sure you want to delete 'guestbook' and all its resources? [y/n] y
application 'guestbook' deleted
[root@master argocd]# argocd app list
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
命令行创建guestbook
[root@master argocd]# argocd app create guestbook --repo https://gitee.com/mageedu/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace guestbook --sync-option createnamespace=true --sync-policy automatic
application 'guestbook' created
登陆web端可以看到已经创建完成了
标签:部署,ArgoCD,argocd,TCP,master,com,root,guestbook From: https://www.cnblogs.com/zyyang1993/p/16880494.html