This documentation is for Flux (v1) and Helm Operator (v1). Both projects are in maintenance mode and will soon reach end-of-life. We strongly recommend you familiarise yourself with the newest Flux and start looking at your migration path.
For documentation regarding the latest Flux, please refer to this section.
Using Git over HTTPS
Instead of making use of Flux’ capabilities to generate an SSH private
supplying your own, it is possible to
set environment variables and use these in your
--git-url argument to
provide your HTTPS basic auth credentials without having to expose them
as a plain value in your workload.
--git-urlwill disable the generation of a private key and prevent the setup of the SSH keyring.
The variables must be escaped with
$() for Kubernetes
to pass the values to the Flux container, e.g.
Each of the username and password must be percent-encoded, otherwise
the git URL may end up being invalid once they have been interpolated
in. You can encode a string with Perl (assuming your token is in the
echo "$TOKEN" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"'
Create a personal access token to be used as the
Create a Kubernetes secret with two environment variables and their respective values (replace
kubectl create secret generic flux-git-auth --from-literal=GIT_AUTHUSER=<username> --from-literal=GIT_AUTHKEY=<token/password>
this will result in a secret that has the structure:
apiVersion: v1 data: GIT_AUTHKEY: <base64 encoded token/password> GIT_AUTHUSER: <base64 encoded username> kind: Secret type: Opaque metadata: ...
Mount the Kubernetes secret as environment variables using
envFromand use them in your
apiVersion: apps/v1 kind: Deployment metadata: name: flux ... spec: containers: - name: flux envFrom: - secretRef: name: flux-git-auth args: # Replace `github.com/...` with your git repository - --git-url=https://$(GIT_AUTHUSER):$(GIT_AUTHKEY)@github.com/fluxcd/flux-get-started.git ...