400 Unauthorized to access the cluster agent in this project when glab cluster agent bootstrap
Checklist
-
I'm using the latest version of the extension (Run glab --version) -
Operating system and version: Linux Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux -
Gitlab.com or self-managed instance? gitlab.com -
I have performed glab auth statusto check for authentication issues -
Run the command in debug mode (like DEBUG=true glab mr list) and attach any useful output
Summary
When running glab cluster agent bootstrap --manifest-path clusters/testing testing, I've got Unauthorized to access the cluster agent in this project.
Environment
- OS: Linux 6.1.0-25-cloud-amd64 x86_64
- SHELL: /bin/bash
- TERM: xterm-256color
- GLAB: Current glab version: 1.53.0
Other:
Steps to reproduce
I've been trying to make a GitOps setup between our Kubernetes cluster and GitLab.
I've been following this guide: Connecting Kubernetes cluster with GitLab.
I did a flux bootstrap command, not without issues either. Here are a more complete issue I've created.
What is the current bug behavior?
In the section Setup the agent connection, where you use GitLab CLI to bootstrap an agent, I receive the following:
glab cluster agent bootstrap --manifest-path cluster/testing testing
Registering Agent ... [OK]
Configuring Agent ... [OK]
Configuring Environment with Dashboard for Agent ... [FAILED]
POST https://gitlab.com/api/v4/projects/<group>/<sub-group>/<project>/environments: 400 {message: Unauthorized to access the cluster agent in this project}
I've checked out the git-project and made sure --manifest-path correspond to the --path I used in flux bootstrap. I've use my personal access token (PAT) with all possible scopes checked-in. I've also tried project access token with max ownership and all scopes. I can see in Operate>Kubernetes clusters that "testing" agent was created, but never accessed.
Is it some sort of permission problem? Earlier I've successfully created and connected an agent manually using Helm (in another project), but since this command makes some more satisfied things then just connecting an agent to the cluster, I want to have a complete setup with Flux and everything setup correctly. I want to checkout dashboard features etc...
What is the expected correct behavior?
I expect glab tool to bootstrap a Kubernetes cluster agent, connect it to the GitLab, and be able to see a Dashboard inside my GitLab project.
Relevant logs and/or screenshots
Kubernetes version: v1.32.2
Helm version:
helm version
version.BuildInfo{Version:"v3.17.1", GitCommit:"980d8ac1939e39138101364400756af2bdee1da5", GitTreeState:"clean", GoVersion:"go1.23.5"}
Flux version:
flux version
flux: v2.5.1
distribution: flux-v2.5.1
helm-controller: v1.2.0
kustomize-controller: v1.5.1
notification-controller: v1.5.0
source-controller: v1.5.0
Version of GitLab CLI:
glab --version
Current glab version: 1.53.0
glab auth status
gitlab.com
✓ Logged in to gitlab.com as michael.burakov (/home/michael/.config/glab-cli/config.yml)
✓ Git operations for gitlab.com configured to use https protocol.
✓ API calls for gitlab.com are made over https protocol.
✓ REST API Endpoint: https://gitlab.com/api/v4/
✓ GraphQL Endpoint: https://gitlab.com/api/graphql/
✓ Token: **************************