I am trying to set up FluxCD with a private GitLab repo. Here is the command I am using to install Flux on a Kubernetes cluster and configure it to manage itself from a Git repository.
flux bootstrap gitlab --hostname=https://gitlab.host.com --owner=devops --namespace=namespace --repository=my-repo --branch=master --interval=30s --path=clusters/Cluster1
Here is the response I am getting for above command:
► connecting to https://gitlab.host.com
► cloning branch "master" from Git repository "https://gitlab.host.com/devops/aks-kubernetes.git"
✔ cloned repository
► generating component manifests
✔ generated component manifests
✔ component manifests are up to date
► installing components in "mynamespace" namespace
✔ installed components
✔ reconciled components
► determining if source secret "mynamespace/flux-system" exists
► generating source secret
✗ SSH key scan for host https://gitlab.host.com failed, error: dial tcp: lookup tcp///gitlab.host.com: getaddrinfow: The specified class was not found.
I am not sure why I am getting this error at this stage. Flux was able to connect to the git and commit the manifest file - gotk-components.yaml. I can see this file in my repo. Any help would be much appreciated. Thanks.
You need to use --ssh-hostname argument also and provide your company's ssh host. So flux will create and add deploy key in your repo automatically. please refer flux document for same. https://fluxcd.io/docs/installation/#gitlab-and-gitlab-enterprise under Authentication section.
So command should look like :-
flux bootstrap gitlab --hostname=https://gitlab.host.com --ssh-hostname gitlab.host.com --owner=devops --namespace=namespace --repository=my-repo --branch=master --interval=30s --path=clusters/Cluster1