Ninja Docs Help

Change sync path

Revision

Date

Description

1.0

24.07.2024

Init Changelog

Introduction

This article explains how to change FluxCD (flux-system) sync path in Kustomization. This may be useful if you migrate your Gitlab Project or change layout in current repository.

Instructions

To change sync path for FluxCD, follow steps below:

  1. Export proper PAT as environment variable:

export GITLAB_TOKEN=<pat>
  1. Set your cluster as active context:

kubectx <context>
  1. Prepare your repository (copy your manifests, add new layout, etc).

  2. Modify field .spec.path in Kustomization resource (gotk-sync.yaml file) to new value.

  3. Run uninstall command:

flux uninstall
  1. Create flux-system namespace:

kubectl create ns flux-system
  1. Apply FluxCD CRDs to omit errors with parsing your existing FluxCD manifests in repo before it will bootstrap again ( this command apply only most used CRDs - if you use more, add them):

k apply \ -f https://raw.githubusercontent.com/fluxcd/kustomize-controller/main/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml \ -f https://raw.githubusercontent.com/fluxcd/source-controller/main/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml \ -f https://raw.githubusercontent.com/fluxcd/source-controller/main/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml \ -f https://raw.githubusercontent.com/fluxcd/image-reflector-controller/main/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml \ -f https://raw.githubusercontent.com/fluxcd/image-reflector-controller/main/config/crd/bases/image.toolkit.fluxcd.io_imagerepositories.yaml \ -f https://raw.githubusercontent.com/fluxcd/image-automation-controller/main/config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml \ -f https://raw.githubusercontent.com/fluxcd/helm-controller/main/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
  1. Bootstrap FluxCD with new values.

Last modified: 17 February 2025