0

I'm new to Kubernetes and Flux. I'm trying to set up a Kubernetes cluster to sync with my Gitlab repo using Flux. I'm following this guide and this guide.

I created my Kubernetes cluster, then I bootstrapped Flux with this command:

GITLAB_TOKEN=<my token> flux bootstrap gitlab \ --owner=<my Gitlab group> \ --repository=<my repo> \ --token-auth 

By default, this created the Flux configurations in my repo in the flux-system/ directory.

Now I'm trying to set up the cluster agent and I run this command:

glab cluster agent bootstrap <agent-name> --manifest-path flux-system 

This seems to be working but eventually fails with error HelmRelease object 'gitlab-agent' not found in "flux-system" namespace. Here's the full output:

Registering Agent ... [OK]

Configuring Agent ... [OK]

Configuring Environment with Dashboard for Agent ... [OK]

Configuring Environment with Dashboard for FluxCD ... [OK]

Creating Agent Token ... [OK]

Creating Kubernetes Secret with Agent Token ... [OK]

Creating Flux Helm Resources ... [OK]

Syncing Flux Helm Resources ... [OK]

Reconciling Flux Helm Resources ... Output from flux command:

► annotating GitRepository flux-system in flux-system namespace

✔ GitRepository annotated

◎ waiting for GitRepository reconciliation

✔ fetched revision main@sha1:

ERROR: failed to reconcile the GitLab Agent:

All attempts fail:

#1: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

#2: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

#3: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

#4: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

#5: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

#6: ✗ HelmRelease object 'gitlab-agent' not found in "flux-system" namespace

I see that it automatically created the agent configuration at .gitlab/agents/<my agent>/config.yaml.

I run kubectl get namespace and I can see that I have a gitlab-agent and a flux-system namespace. I run flux get helmreleases and get:

✗ no HelmRelease objects found in "flux-system" namespace

I'm not super well-versed on Kubernetes/kubectl and not at all with Helm or Flux, so how do I go about troubleshooting this?

1 Answer 1

2

The flux bootstrap and glab cluster agent bootstrap created configurations in my repository for a HelmRepository and a HelmRelease. All I had to do was apply them then the glab cluster agent bootstrap worked:

kubectl apply -f flux-system/gitlab-helm-repository.yaml kubectl apply -f flux-system/gitlab-agent-helm-release.yaml GITLAB_TOKEN=<my token> glab cluster agent bootstrap workspace-agent --manifest-path flux-system 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.