# ArgoCD GitOps-инструмент для непрерывного деплоя. Синхронизирует состояние кластера с Git-репозиторием. Устанавливается через Helm, поддерживает Ingress, TLS и интеграцию с Prometheus. ## Быстрый старт ```yaml # group_vars/all/addons.yml addon_argocd: true ``` ```bash make addon-argocd ``` ## Параметры | Переменная | Умолч. | Описание | |---|---|---| | `argocd_ingress_enabled` | `false` | Включить Ingress | | `argocd_ingress_host` | `argocd.example.com` | Hostname | | `argocd_ingress_tls` | `false` | TLS через cert-manager | | `argocd_metrics_enabled` | `true` | Prometheus метрики | | `argocd_redis_mode` | `auto` | `auto` \| `internal` \| `external_redis` | ```yaml # group_vars/all/addons.yml argocd_ingress_enabled: true argocd_ingress_host: "argocd.example.com" argocd_ingress_tls: true ``` ## Режим Redis (встроенный или внешний) Выбор задаётся переменной `argocd_redis_mode`: - `auto` — внешний Redis при `addon_redis: true`, иначе встроенный Redis чарта; - `internal` — всегда встроенный Redis; - `external_redis` — всегда внешний Redis (например из addon `redis`). ## Первый вход После установки Ansible выводит начальный пароль. Сменить: ```bash argocd login argocd.example.com argocd account update-password ``` Или получить начальный пароль вручную: ```bash kubectl -n argocd get secret argocd-initial-admin-secret \ -o jsonpath='{.data.password}' | base64 -d ``` ## Создать приложение ### Через CLI ```bash argocd app create my-app \ --repo https://github.com/org/repo.git \ --path k8s/ \ --dest-server https://kubernetes.default.svc \ --dest-namespace default \ --sync-policy automated ``` ### Через манифест ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: my-app namespace: argocd spec: project: default source: repoURL: https://github.com/org/repo.git targetRevision: main path: k8s/ destination: server: https://kubernetes.default.svc namespace: my-app syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true ``` ## ApplicationSet — деплой в несколько кластеров/окружений ```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: my-app-environments namespace: argocd spec: generators: - list: elements: - cluster: staging url: https://staging-k8s:6443 - cluster: production url: https://prod-k8s:6443 template: metadata: name: 'my-app-{{cluster}}' spec: source: repoURL: https://github.com/org/repo.git path: 'environments/{{cluster}}' destination: server: '{{url}}' namespace: my-app ``` ## Helm чарт через ArgoCD ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: my-helm-app namespace: argocd spec: source: repoURL: https://charts.example.com chart: my-chart targetRevision: "1.2.3" helm: values: | replicaCount: 2 ingress: enabled: true host: app.example.com destination: server: https://kubernetes.default.svc namespace: my-app ``` ## Интеграция с Gitea/GitHub В ArgoCD UI → Settings → Repositories → Connect Repo: ```yaml # Или через Secret: apiVersion: v1 kind: Secret metadata: name: gitea-repo namespace: argocd labels: argocd.argoproj.io/secret-type: repository stringData: type: git url: https://gitea.example.com/org/repo.git username: gitea password: "token-or-password" ``` ## Официальные ресурсы - Официальный сайт: [https://argo-cd.readthedocs.io/](https://argo-cd.readthedocs.io/) - Официальная документация: [https://argo-cd.readthedocs.io/](https://argo-cd.readthedocs.io/) - Версии Helm chart / ПО: [https://artifacthub.io/packages/helm/argo/argo-cd](https://artifacthub.io/packages/helm/argo/argo-cd)