#!/bin/bash # 在 prod102 上安装 Argo CD 3.5.4。 # 安装清单是同目录上一级的 config/argocd-install.yaml。 # 清单收进 Git、交给 Application 的步骤在 13。现网仓库已经是 GitLab,13 发现 Application 后会退出。 set -eu export KUBECONFIG=/root/.kube/config if kubectl get ns argocd >/dev/null 2>&1 && kubectl -n argocd get deploy argocd-server >/dev/null 2>&1; then echo "Argo CD 已经在跑。这份脚本停在这里,避免重复安装。" exit 1 fi MANIFEST="$(dirname "$0")/../config/argocd-install.yaml" if [ ! -f "$MANIFEST" ]; then echo "缺少 $MANIFEST" exit 1 fi kubectl create namespace argocd --dry-run=client -o yaml | kubectl apply -f - kubectl apply -n argocd --server-side --force-conflicts -f "$MANIFEST" kubectl -n argocd rollout status deploy/argocd-server --timeout=240s kubectl -n argocd rollout status deploy/argocd-repo-server --timeout=240s kubectl -n argocd rollout status statefulset/argocd-application-controller --timeout=240s kubectl -n argocd rollout status deploy/argocd-applicationset-controller --timeout=240s kubectl -n argocd rollout status deploy/argocd-dex-server --timeout=240s kubectl -n argocd rollout status deploy/argocd-redis --timeout=240s kubectl -n argocd rollout status deploy/argocd-notifications-controller --timeout=240s || true echo "Argo CD 组件已就绪"