본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Flux Mirror Sync 명령

원문 보기 위키 갱신

flux mirror sync 명령이 레지스트리 간에 Helm 차트와 OCI 아티팩트를 어떻게 미러링하는지 소개합니다.

출처: 문서

본문

flux mirror sync 명령은 선언적 구성(Config)을 기반으로 레지스트리 간에 Helm 차트와 OCI 아티팩트를 미러링합니다. 이 명령은 멱등성(idempotent)이 있습니다: 같은 구성에 대해 다시 실행하면 같은 목적지 상태를 만들며, 누락되었거나 드리프트된 것만 복사합니다.

시놉시스 (Synopsis)

flux mirror sync [CONFIG|-] [flags]

구성 소스

구성 경로는 다음 순서로 해석됩니다:

  • 첫 번째 위치 인자 (-는 stdin에서 구성을 읽음).
  • FLUX_MIRROR_CONFIG 환경 변수.

둘 다 설정되지 않으면 명령이 오류를 냅니다. login과 secret과 달리, sync에는 실행 파일 상대 기본 경로가 없습니다.

flux mirror sync ./flux-mirror.yaml
flux mirror sync -

인증 (Authentication)

sync는 레지스트리 호스트별로 OCI 레지스트리 요청(artifacts 소스/목적지와 charts의 oci:// 목적지)을 인증합니다:

  • hosts 아래에 나열된 호스트는 구성된 authentication.provider: ecr|acr|gar를 사용해 클라우드 제공자의 워크로드 아이덴티티에서 레지스트리의 네이티브 자격 증명을 얻습니다.
  • credential은 클라우드/CI 아이덴티티, JWK 서명, 또는 환경 변수나 파일에서 호스트별 토큰을 해석합니다. username이 없으면 HTTP Bearer 자격 증명으로 보내집니다. username이 있으면 표준 레지스트리 인증 챌린지의 비밀번호입니다.
  • hosts 아래에 나열되지 않은 호스트는 주변 Docker 구성과 자격 증명 헬퍼(~/.docker/config.json 또는 설정 시 $DOCKER_CONFIG)를 사용합니다.

provider가 아닌 호스트는 레지스트리 연결을 위한 전송 계층 TLS를 구성하도록 tls를 설정할 수도 있습니다: 사용자 정의 CA, 클라이언트 인증서(mTLS), 또는 SPIFFE X.509-SVID mTLS.

HTTP/S Helm 저장소 인증(charts 소스용)은 OCI 인증과 분리되어 있으며 항상 주변 Helm 저장소 구성에서 가져옵니다:

  • Helm의 기본 repositories.yaml 경로, 또는 설정 시 $HELM_REPOSITORY_CONFIG.
  • username/password, certFile, keyFile, caFile, insecure_skip_tls_verify, pass_credentials_all 필드가 인정됩니다.

helm repo add로 저장소를 추가하면 flux mirror가 일치하는 HTTP/S 저장소 자격 증명을 자동으로 선택합니다.

플래그

| 플래그 | 기본값 | 설명 | | -o, --output text|yaml|json | text | 출력 형식. text는 사람 친화적입니다. yaml과 json은 구조화된 sync 보고서를 stdout에 출력합니다. | | --concurrency N | 4 | 작업당 병렬로 실행할 최대 복사 작업 수. 0보다 커야 합니다. | | --retries N | 3 | --timeout 예산 내에서 작업당 최대 재시도 횟수. 0보다 크거나 같아야 합니다. | | --timeout DURATION | 5m | 모든 재시도 시도를 포함한 작업당 총 예산. 0보다 커야 합니다. | | --overwrite | false | 항목별 구성과 상관없이 모든 항목에 강제 true로 덮어쓰기. Overwrite 및 drift 동작 참조. | | --drift-exit-code N | 2 | 실패 없이 drift가 감지되었을 때 사용할 종료 코드 (0–255). drift에서 CI가 실패하지 않아야 하는 불변 목적지에는 0으로 설정. | | --dry-run | false | 어떤 쓰기도 수행하지 않고 계획 및 비교 파이프라인 실행. would-copy / would-overwrite로 보고됨. | | --verbose | false | 모든 작업과 관련 다이제스트를 stderr에 기록. 스피너를 억제합니다. | | --no-progress | false | 실시간 진행 스피너 비활성화. 작업별 줄과 요약은 여전히 출력됩니다. | | --insecure | false | 평문 HTTP 허용 및 TLS 검증 건너뜀. 테스트/개발 전용. |

전역 플래그: --timeout은 기본 작업 타임아웃을 설정하고, --no-envsubst는 구성 환경 치환을 비활성화합니다.

출력

텍스트 모드 (기본)

✓ ghcr.io/stefanprodan/charts/podinfo:6.10.2 (skipped)
→ localhost:5050/charts/podinfo:6.10.2
✓ ghcr.io/stefanprodan/charts/podinfo:6.11.0 (copied)
→ localhost:5050/charts/podinfo:6.11.0
✗ ghcr.io/stefanprodan/charts/podinfo2 — plan failed: NAME_UNKNOWN
Summary: 1 copied, 1 skipped, 1 failed in 4.2s.

상세 모드

--verbose는 이쁜 출력을 완전한 진단 로그 스트림으로 대체합니다 (stderr) — 모든 레이어 push, blob 검사, 매니페스트 다이제스트, referrer 폴백 태그 갱신, 레지스트리 측 경고. TLS, auth, missing-blob, push-rejection 문제를 진단할 때 사용하세요.

2026/05/13 09:00:00 sync started entries=3 concurrency=4 retries=3 timeout=5m0s
2026/05/13 09:00:00 mirroring tag src=ghcr.io/foo/bar:1.0 dst=localhost:5050/bar:1.0
2026/05/13 09:00:00 Copying from ghcr.io/foo/bar:1.0 to localhost:5050/bar:1.0
2026/05/13 09:00:00 pushed blob: sha256:fdf53ef8e04176eedbd42713efb2d002f1741c310627b38f444c6f6d92a598f7
2026/05/13 09:00:01 tag done src=ghcr.io/foo/bar:1.0 status=copied elapsed=812ms
…
2026/05/13 09:00:04 sync complete entries=3 copied=1 overwritten=0 skipped=1 drifted=0 failed=1 duration=4.213s

구조화 출력

-o yaml과 -o json은 버전이 있는 보고서를 stdout에 출력합니다: 실행 메타데이터(reporter, timestamp, durationMs)를 감싸는 최상위 envelope(apiVersion, kind, $schema, report), 상태별 태그 수의 집계 summary, 그리고 각 항목이 status(completed/failed)와 태그별 행의 tags[] 배열을 담는 results[]. 각 행은 status를 갖고, 알려지면 소스 digest를 갖습니다. 건너뛴 행은 reason을 갖고, 검증된 행은 verification 블록을 갖고, includeReferrers: true이면 referrers[] 배열을 갖습니다. envelope은 sync 보고서 스키마로 문서화됩니다.

# Status of every tag, per entry
flux mirror sync config.yaml -o json | jq '.report.results[].tags[] | {tag, status}'

# Tags that were copied
flux mirror sync config.yaml -o json | jq '.report.results[].tags[] | select(.status == "copied") | .tag'

# Aggregate counts
flux mirror sync config.yaml -o json | jq '.report.summary'

상태 (Status)

각 태그 행(및 각 referrer 행)은 정확히 다음 상태 중 하나에 속합니다:

| 상태 | 의미 | | copied | 목적지에 태그가 없어서 소스에서 미러링됨. | | overwritten | 목적지에 다른 다이제스트가 있어서 교체됨 (overwrite: true에서만). | | skipped | 아무것도 복사되지 않음. 행의 reason이 이유를 설명. | | drifted | 목적지에 다른 다이제스트가 있고, overwrite: false — 그대로 두고 요약에 표시. | | would-copy | Dry-run 예측: 복사되었을 것. | | would-overwrite | Dry-run 예측: 덮어쓰여졌을 것. | | failed | 작업이 오류 발생. 행의 error가 메시지를 담음. |

skipped 행의 reason은 up-to-date(목적지가 이미 같은 다이제스트) 또는 signature-too-new(verify.minAge에 의해 연기된 유효 서명)입니다.

실패한 서명 검증(잘못되거나 누락된 서명, OIDC 불일치)은 verify 오류를 담은 failed 태그 행으로 기록됩니다. 검증은 계획 시간에 실행되므로 첫 실패가 항목을 멈추지만(그 전에 검증된 태그는 여전히 실행됨), 항목 자체는 completed로 유지됩니다. 진짜 계획 시간 실패(예: 소스 레지스트리가 ListTags를 거부)는 status: "failed", error, 비어 있는 tags 배열을 가진 항목으로 나타나며, ✗ <name> — plan failed: <error> 줄로 실시간 보고됩니다. 두 종류 모두 failed로 집계됩니다.

Referrers

항목이 includeReferrers: true를 설정하면 각 태그 행은 referrers[] 배열을 얻습니다 — 미러링된 각 하위 아티팩트(cosign 서명 번들, SBOM, 증명)에 대해 한 행씩이며, 각각 자체 digest, artifactType, status, 그리고 (건너뛴 경우) reason을 갖습니다. Referrers는 --dry-run에서도 평가됩니다.

종료 코드

| 코드 | 의미 | | 0 | 정상 실행 — 모든 태그가 예상대로 복사되거나 건너뛰어졌고, drift도 실패도 없음. | | 1 | 하나 이상의 태그 작업 실패 (네트워크 오류, push 거부, 재시도 소진, 계획 실패). | | 2 | 실패는 없지만, overwrite: false로 하나 이상의 태그가 drift됨. 목적지가 소스에 비해 구식. |

실패가 drift보다 우선합니다. --dry-run은 would-copy/would-overwrite에 대해 종료 코드를 올리지 않지만, drift 감지는 여전히 기본적으로 2를 만듭니다. 목적지 레지스트리가 불변으로 알려져 있고 drift를 CI 실패 없이 기록만 하려면 --drift-exit-code=0을 사용하세요.

예제

HTTP/S Helm 차트를 OCI Helm 차트로 미러링

많은 일반 Kubernetes 에코시스템 컴포넌트는 여전히 클래식 HTTP/S Helm 저장소에만 게시되고 OCI Helm 차트를 제공하지 않습니다. charts 섹션은 그런 차트를 HTTP/S로 가져와 OCI Helm 차트로 다시 게시해 클러스터가 단일 OCI 레지스트리에서 소비할 수 있게 합니다.

이 구성은 몇몇 차트를 GitHub Container Registry (GHCR)로 미러링합니다:

# flux-mirror.yaml
apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
charts:
  - name: ingress-nginx
    source: https://kubernetes.github.io/ingress-nginx
    destination: oci://ghcr.io/my-org/charts
    version: ">=4.11.0"
    limit: 3
  - name: cert-manager
    source: https://charts.jetstack.io
    destination: oci://ghcr.io/my-org/charts
    version: ">=1.15.0"
    limit: 3
  - name: metrics-server
    source: https://kubernetes-sigs.github.io/metrics-server
    destination: oci://ghcr.io/my-org/charts
    version: ">=3.12.0"
    limit: 3
  - name: kube-prometheus-stack
    source: https://prometheus-community.github.io/helm-charts
    destination: oci://ghcr.io/my-org/charts
    version: ">=60.0.0"
    limit: 3
hosts:
  # GHCR is the push destination. It expects a username/password login (the
  # username is any non-empty value; GHCR authorizes by the token), so `username`
  # is set and GITHUB_TOKEN is the password.
  - host: ghcr.io
    username: my-org
    credential:
      value: ${GH_TOKEN}

각 차트는 ghcr.io/my-org/charts/<name>:<version>에 위치합니다. GitHub Actions에서 packages: write로 실행해 워크플로의 GITHUB_TOKEN이 push할 수 있게 하세요:

# .github/workflows/mirror-charts.yaml
name: mirror-charts
on:
  schedule:
    - cron: "0 */6 * * *"
  workflow_dispatch:
permissions:
  contents: read
  packages: write
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: fluxcd/flux-mirror/actions/setup@main
      - run: flux-mirror sync ./flux-mirror.yaml --no-progress
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

OCI Helm 차트를 OCI Helm 차트로 미러링

이미 OCI 레지스트리에 있는 Helm 차트는 일반 OCI 아티팩트로 OCI-to-OCI 미러링됩니다. artifacts 섹션이 OCI 저장소 간에 OCI Helm 차트를 미러링하는 유일한 방법입니다 — charts 섹션은 HTTP/S 소스 전용입니다.

apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
artifacts:
  - source: ghcr.io/stefanprodan/charts/podinfo
    destination: ghcr.io/my-org/charts/podinfo
    selector:
      semver: ">=6.0.0"
      limit: 5

GHCR 이미지를 개인 레지스트리로 미러링

이것은 GitHub Actions에서 ghcr.io/fluxcd 컨트롤러 이미지를 개인 레지스트리로 미러링합니다. 목적지는 GitHub Actions 시크릿의 username/password로 인증합니다. GHCR 소스는 익명 pull 속도 제한을 피하기 위해(익명으로 가져오지 않고) GITHUB_TOKEN으로 인증합니다 — GHCR은 username/password 로그인을 기대하므로 여기에도 username이 설정됩니다.

# flux-mirror.yaml
apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
artifacts:
  - source: ghcr.io/fluxcd/source-controller
    destination: registry.internal.example.com/fluxcd/source-controller
    selector:
      semver: ">=1.0.0"
      limit: 5
    includeReferrers: true
  - source: ghcr.io/fluxcd/kustomize-controller
    destination: registry.internal.example.com/fluxcd/kustomize-controller
    selector:
      semver: ">=1.0.0"
      limit: 5
    includeReferrers: true
hosts:
  # Source: authenticate to GHCR to avoid anonymous rate limits.
  - host: ghcr.io
    username: my-org
    credential:
      value: ${GH_TOKEN}
  # Destination: a private registry expecting a username/password login. The
  # username and password are substituted from the environment while loading the
  # config.
  - host: registry.internal.example.com
    username: ${REGISTRY_USERNAME}
    credential:
      value: ${REGISTRY_PASSWORD}
# .github/workflows/mirror-images.yaml
name: mirror-images
on:
  schedule:
    - cron: "0 */6 * * *"
permissions:
  contents: read
  packages: read
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: fluxcd/flux-mirror/actions/setup@main
      - name: Substitute the destination username into the config
        run: envsubst '${REGISTRY_USERNAME}' < flux-mirror.yaml > rendered.yaml
        env:
          REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
      - run: flux-mirror sync ./rendered.yaml --no-progress
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

GitHub Actions에서 ECR, ACR, GAR로 미러링

컨테이너 이미지, OCI Helm 차트, Flux OCI 아티팩트를 클라우드 레지스트리로 미러링하려면, 클라우드 제공자 GitHub Actions OIDC 로그인 액션으로 인증한 다음 목적지 호스트에 hosts[].provider를 설정해 flux-mirror가 그 주변 아이덴티티를 재사용하게 하세요. 여기서 소스는 GHCR이며 GITHUB_TOKEN으로 인증됩니다.

구성은 목적지 호스트와 provider를 제외하고 세 클라우드 모두 동일합니다:

# flux-mirror.yaml — Amazon ECR destination
apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
artifacts:
  - source: ghcr.io/fluxcd/source-controller   # container image
    destination: 123456789012.dkr.ecr.us-east-1.amazonaws.com/fluxcd/source-controller
    selector: { semver: ">=1.0.0", limit: 5 }
    includeReferrers: true
  - source: ghcr.io/stefanprodan/charts/podinfo # OCI Helm chart
    destination: 123456789012.dkr.ecr.us-east-1.amazonaws.com/charts/podinfo
    selector: { semver: ">=6.0.0", limit: 5 }
  - source: ghcr.io/stefanprodan/manifests/podinfo # Flux OCI artifact
    destination: 123456789012.dkr.ecr.us-east-1.amazonaws.com/manifests/podinfo
    selector: { regex: { pattern: "^latest$" }, sortBy: alphabetical }
hosts:
  - host: ghcr.io
    username: my-org
    credential:
      value: ${GH_TOKEN}
  - host: 123456789012.dkr.ecr.us-east-1.amazonaws.com
    provider: ecr

ACR 또는 GAR의 경우 목적지 호스트와 provider만 변경하세요:

# Azure ACR
  - host: myregistry.azurecr.io
    provider: acr
# Google GAR
  - host: us-docker.pkg.dev
    provider: gar

워크플로는 클라우드 로그인 단계만 다르며, 모두 GitHub Actions OIDC를 사용합니다 (장기 클라우드 키 없음):

# .github/workflows/mirror-to-ecr.yaml
name: mirror-to-ecr
on:
  schedule:
    - cron: "0 */6 * * *"
permissions:
  contents: read
  packages: read
  id-token: write          # required for GitHub Actions OIDC
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: fluxcd/flux-mirror/actions/setup@main
      # --- Amazon ECR ---
      - uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/flux-mirror
          aws-region: us-east-1
      # --- Azure ACR (instead of the AWS step) ---
      # - uses: azure/login@v2
      #   with:
      #     client-id: ${{ secrets.AZURE_CLIENT_ID }}
      #     tenant-id: ${{ secrets.AZURE_TENANT_ID }}
      #     subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      # --- Google GAR (instead of the AWS step) ---
      # - uses: google-github-actions/auth@v2
      #   with:
      #     workload_identity_provider: projects/123/locations/global/workloadIdentityPools/gh/providers/gh
      #     service_account: flux-mirror@my-project.iam.gserviceaccount.com
      - run: flux-mirror sync ./flux-mirror.yaml --no-progress
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

워크로드 아이덴티티로 CronJob에서 ECR, ACR, GAR로 미러링

클러스터 안에서 CronJob은 pod의 워크로드 아이덴티티를 사용해 일정대로 미러링할 수 있습니다. 목적지 클라우드 레지스트리는 hosts[].provider로 인증됩니다 (IRSA, AKS Workload Identity, 또는 GKE Workload Identity의 주변 클라우드 자격 증명 체인 사용). 여기서 소스 레지스트리는 클러스터의 ServiceAccount OIDC 토큰을 허용하므로, projected ServiceAccount 토큰이 HTTP Bearer 자격 증명(username 없음)으로 보내져 인증됩니다.

먼저 각 제공자의 워크로드 아이덴티티에 대해 어노테이션이 달린 ServiceAccount. projected 토큰의 audience는 소스 레지스트리 호스트여야 합니다:

# EKS with IRSA (annotation mandatory)
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flux-mirror
  namespace: flux-system
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/flux-mirror
# EKS Pod Identity needs no annotation (the association is created via the EKS
# API); the same ServiceAccount works.
---
# AKS Workload Identity (annotation mandatory; the pod also needs the
# azure.workload.identity/use: "true" label)
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flux-mirror
  namespace: flux-system
  annotations:
    azure.workload.identity/client-id: 00000000-0000-0000-0000-000000000000
---
# GKE Workload Identity Federation. With direct KSA-to-IAM bindings no
# annotation is needed; when impersonating a GCP service account, annotate it:
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flux-mirror
  namespace: flux-system
  annotations:
    iam.gke.io/gcp-service-account: flux-mirror@my-project.iam.gserviceaccount.com

구성은 목적지를 provider로, 소스를 projected 토큰으로 인증합니다. 파일 경로 필드는 구성의 자체 디렉터리로 제한되므로, 구성과 토큰을 함께 마운트해(아래) 상대 fromPath가 해석되게 합니다:

# mirror.yaml
apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
artifacts:
  - source: source-registry.example.com/library/app
    destination: 123456789012.dkr.ecr.us-east-1.amazonaws.com/library/app
    selector: { semver: ">=1.0.0", limit: 5 }
hosts:
  # Source: a registry that validates the cluster's ServiceAccount OIDC token.
  # No username → the token is sent as an HTTP Bearer credential. Its audience
  # (the source host) is set by the projected-token volume, not here.
  - host: source-registry.example.com
    credential:
      fromPath: registry-token
  # Destination: ECR via the pod's IRSA identity (use acr/gar to switch clouds).
  - host: 123456789012.dkr.ecr.us-east-1.amazonaws.com
    provider: ecr

CronJob은 어노테이션이 달린 ServiceAccount로 실행되고 audience가 소스 레지스트리인 토큰을 투영하며, 상대 fromPath가 구성 디렉터리 안에 머물도록 구성과 함께 한 볼륨에 결합합니다:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: flux-mirror
  namespace: flux-system
spec:
  schedule: "0 */6 * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            azure.workload.identity/use: "true"   # AKS Workload Identity only
        spec:
          serviceAccountName: flux-mirror
          restartPolicy: OnFailure
          containers:
            - name: flux-mirror
              image: ghcr.io/fluxcd/flux-mirror:latest
              args: ["sync", "/config/flux/mirror.yaml", "--no-progress"]
              volumeMounts:
                - name: flux
                  mountPath: /config/flux
                  readOnly: true
          volumes:
            # One projected volume holds both the config and the registry token,
            # so /config/flux/mirror.yaml can reference ./registry-token.
            - name: flux
              projected:
                sources:
                  - configMap:
                      name: flux-mirror-config   # holds mirror.yaml
                  - serviceAccountToken:
                      path: registry-token
                      audience: source-registry.example.com
                      expirationSeconds: 3600

AWS 자격 증명 제공자로 SPIFFE mTLS 레지스트리로 미러링

이 CronJob은 호출자의 AWS 아이덴티티를 인증하는 레지스트리에서 컨테이너 이미지를 가져와, SPIFFE X.509-SVID mTLS가 필요한 레지스트리로 push합니다. 소스 호스트는 소스 레지스트리가 AWS STS에 재생하는 sts:GetCallerIdentity 요청에 서명하는 aws 자격 증명 제공자를 사용하므로, pod는 IRSA를 통한 AWS 자격 증명이 필요합니다. 목적지 호스트는 SPIFFE 클라이언트 인증서와 SPIFFE 서버 검증을 가진 tls를 사용하며 HTTP 자격 증명은 사용하지 않습니다 — 레지스트리는 클라이언트를 X.509-SVID로 인가합니다. SPIFFE SVID와 trust bundle은 SPIFFE CSI 드라이버가 pod에 노출하는 Workload API에서 옵니다. go-spiffe는 SPIFFE_ENDPOINT_SOCKET을 통해 소켓을 찾습니다.

ServiceAccount는 aws 제공자가 매핑된 AWS 역할로 서명할 수 있도록 IRSA용으로 어노테이션됩니다:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: flux-mirror
  namespace: flux-system
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/flux-mirror
# mirror.yaml
apiVersion: mirror.plugin.fluxcd.io/v1beta1
kind: Config
artifacts:
  - source: source-registry.example.com/library/app
    destination: registry.example.org/library/app
    selector: { semver: ">=1.0.0", limit: 5 }
hosts:
  # Source: a registry that validates the caller's AWS identity. No username →
  # the signed sts:GetCallerIdentity envelope is sent as an HTTP Bearer credential.
  - host: source-registry.example.com
    credential:
      provider: aws
  # Destination: SPIFFE mTLS in both directions, no HTTP credential. Our client
  # X.509-SVID authenticates us; the server's SVID is verified against our own
  # trust domain.
  - host: registry.example.org
    tls:
      clientAuth:
        provider: x509-svid
      serverAuth:
        spiffe:
          trustDomain: self
apiVersion: batch/v1
kind: CronJob
metadata:
  name: flux-mirror
  namespace: flux-system
spec:
  schedule: "0 */6 * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: flux-mirror
          restartPolicy: OnFailure
          containers:
            - name: flux-mirror
              image: ghcr.io/fluxcd/flux-mirror:latest
              args: ["sync", "/config/flux/mirror.yaml", "--no-progress"]
              env:
                # go-spiffe reads the Workload API socket from this variable.
                - name: SPIFFE_ENDPOINT_SOCKET
                  value: unix:///spiffe-workload-api/spire-agent.sock
              volumeMounts:
                - name: config
                  mountPath: /config/flux
                  readOnly: true
                - name: spiffe-workload-api
                  mountPath: /spiffe-workload-api
                  readOnly: true
          volumes:
            - name: config
              configMap:
                name: flux-mirror-config   # holds mirror.yaml
            # The SPIFFE CSI driver exposes the SPIRE Agent Workload API socket.
            - name: spiffe-workload-api
              csi:
                driver: csi.spiffe.io
                readOnly: true

미리보기, 재동기화, CI 호출

# Preview the plan without writing to the destination.
flux mirror sync ./flux-mirror.yaml --dry-run -o yaml

# Force-resync every drifted tag.
flux mirror sync ./flux-mirror.yaml --overwrite

# CI-friendly: no spinner. For immutable destinations, keep CI green on drift.
flux mirror sync ./flux-mirror.yaml --no-progress --drift-exit-code=0