هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
Argo CD runs in the cluster and watches Git repositories. An Application says: "this path in this repo (plain YAML, Kustomize or Helm) goes to this cluster and namespace". When Git changes, Argo CD syncs the cluster; when someone changes the cluster by hand, it shows OutOfSync and can self-heal. Rollback = git revert.
The argocd CLI talks to the Argo CD API server. The same can be done with kubectl apply of Application YAML (the GitOps way) or in the web UI.
طريقة الكتابة
argocd login SERVER
argocd app create|get|sync|diff|history|rollback NAMEالأجزاء الرئيسية
Commands
loginSERVER- Log in to Argo CD.
appcreateNAME…- Create an Application.
applist/appgetNAME- Show apps and their sync and health status.
appsyncNAME- Sync now.
appdiffNAME- Show the difference between Git and the cluster.
apphistory/approllbackNAMEID- Revisions / go back.
appsetNAME--sync-policyautomated- Change settings.
appdeleteNAME- Delete the app (and its resources by default).
repoaddURL- Add a Git or Helm repository.
clusteraddCONTEXT- Add another cluster.
projcreate|list- Projects (limits on repos, clusters, namespaces).
accountupdate-password- Change the password.
admininitial-password- Show the first admin password.
الخيارات 8
الأكثر استخدامًا
app create flags
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Install Argo CD in the cluster
2Log in through a port-forward
kubectl -n argocd port-forward svc/argocd-server 8443:443 & argocd admin initial-password -n argocd argocd login localhost:8443 --username admin --insecure argocd account update-password3Create an app that syncs by itself
argocd app create shop --repo https://github.com/s0sta/platform.git --path apps/shop/overlays/prod --dest-server https://kubernetes.default.svc --dest-namespace shop --sync-policy automated --self-heal --auto-prune --sync-option CreateNamespace=true4The same as YAML in Git (GitOps)
cat apps/shop.yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: { name: shop, namespace: argocd } spec: project: default source: repoURL: https://github.com/s0sta/platform.git path: apps/shop/overlays/prod targetRevision: main destination: { server: https://kubernetes.default.svc, namespace: shop } syncPolicy: automated: { prune: true, selfHeal: true } syncOptions: [CreateNamespace=true] kubectl apply -f apps/shop.yaml5Check status and differences
argocd app list argocd app get shop argocd app diff shop6Sync by hand and wait
argocd app sync shop argocd app wait shop --health --timeout 3007Roll back
argocd app history shop argocd app rollback shop 4With auto-sync on, Argo CD syncs Git again; the clean rollback is a git revert.
8Install a Helm chart as an app
argocd app create ingress --repo https://kubernetes.github.io/ingress-nginx --helm-chart ingress-nginx --revision 4.11.3 --dest-server https://kubernetes.default.svc --dest-namespace ingress-nginx --sync-option CreateNamespace=true9Add a private repository
argocd repo add git@github.com:s0sta/platform.git --ssh-private-key-path ~/.ssh/argocd_deploy10Limit a team with a project
argocd proj create team-a --src https://github.com/s0sta/team-a.git --dest https://kubernetes.default.svc,team-a
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- Delete the
argocd-initial-admin-secretafter you change the password; better, use SSO. - Give Argo CD read-only deploy keys for Git.
- Never expose argocd-server to the internet without SSO and TLS.
الملفات
~/.config/argocd/config- CLI login data.
نصائح للحفظ
- The "app of apps" pattern: one Application that points to a folder with all other Applications.
- Use Argo CD Image Updater or a CI commit to change image tags in Git.
رموز الخروج
0 | Success. |
1 | Error. |
20 | App is not synced or not healthy (with app wait). |