
- GitRepository (apiVersion:
source.toolkit.fluxcd.io/v1beta2) configures where the source controller fetches manifests from:url— HTTP or SSH Git URL.ref.branch— branch to track (example:main).secretRef— Kubernetes Secret used for authentication (required for private SSH repos).interval— how often the source controller checks the repo for changes.
- Kustomization (apiVersion:
kustomize.toolkit.fluxcd.io/v1beta2) tells the Kustomize controller which artifacts to apply:sourceRefpoints to the GitRepository defined above.pathselects the subdirectory in the repo to apply.prune: trueenables deletion of resources removed from the Git path.
If you use an SSH Git URL, ensure a matching Secret exists in the same namespace (for example
flux-system) containing the private key. For public HTTPS repos, authentication is not required.sid-demo/bb-app-source. It contains application source code in src/ and Kubernetes manifests in manifests/. For the demo we imported this repository into our own GitHub account and used branch 1-demo.


1-demo branch.

Example HTML/PHP snippet (the app reads pod metadata from environment variables):
path used in the Kustomization CR above). Example workflow:
/data/gitrepository/<name>/<name>/. You can exec into the source-controller pod to list and inspect the tarball:
http://<node-ip>:30001http://localhost:30001(if your node is local)

- The Flux source controller polls the configured
GitRepositoryand stores an artifact (tarball) of the repository state for the specified revision. - The
Kustomizationresource points to that source and apathwithin the repo. The Kustomize controller applies resources found in that path. spec.intervalcontrols polling frequency;spec.prune: truewill delete cluster resources that are removed from Git when the Kustomization is reconciled.- For private SSH repos ensure a Secret with the SSH private key exists in the same namespace as the GitRepository.
- Flux GitRepository and source controller: https://fluxcd.io/docs/components/source/
- Kustomization and kustomize-controller: https://fluxcd.io/docs/components/kustomize/
- Flux CLI documentation: https://fluxcd.io/docs/cmd/
- GitHub Import repository feature: https://docs.github.com/en/importing-your-projects-to-github/importing-a-repository-with-github-importer