Command 'glab cluster agent bootstrap' fail creating secret with microk8s
Checklist
-
I'm using the latest version of the extension (Run glab --version)- Extension version: 1.49.0
-
Operating system and version: Ubuntu 22.04.5 LTS -
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
I want to install a gilab agent on my microk8s cluster. I followed the official tutorial here. But it failed at some point:
Command used:
glab cluster agent bootstrap agentname --manifest-path clusters/microk8s
Output:
Registering Agent ... [OK]
Configuring Agent ... [OK]
Configuring Environment with Dashboard for Agent ... [OK]
Creating Agent Token ... [OK]
Creating Kubernetes Secret with Agent Token ... [FAILED]
command failed with "exit status 64" and output:
error: unknown command "create", see 'snap help'.
Environment
I am using MicroK8s v1.31.2 revision 7394. I have flux 2.4.0 and glab 1.49.0 installed.
- OS: Linux 5.15.0-125-generic x86_64
- SHELL: /bin/bash
- TERM: xterm-256color
- GLAB: Current glab version: 1.49.0
Other:
I have bootstrapped Flux into the cluster using:
flux bootstrap gitlab --owner=qdeabreu --repository=myrepo --branch=main --path=clusters/microk8s --deploy-token-auth --kubeconfig=./microk8s-kubeconfig
I have initialized a git repo:
git init
git remote add origin https://gitlab.com/qdeabreu/myrepo.git
In order to use microk8s I have created a symbolic link to kubectl:
ln -s /snap/bin/microk8s.kubectl /usr/local/bin/kubectl
Steps to reproduce
snap install microk8s
curl -s https://fluxcd.io/install.sh | sudo bash
wget https://gitlab.com/gitlab-org/cli/-/releases/v1.49.0/downloads/glab_1.49.0_linux_amd64.deb
apt install ./glab_1.49.0_linux_amd64.deb
ln -s /snap/bin/microk8s.kubectl /usr/local/bin/kubectl
git init
git remote add origin https://gitlab.com/<yourgroup>/<yourrepo>.git
Bootstrap Flux into the cluster. official gitlab tutorial
glab cluster agent bootstrap agentname --manifest-path clusters/microk8s
What is the current bug behavior?
The command failed on step 5 creating secret:
Registering Agent ... [OK]
Configuring Agent ... [OK]
Configuring Environment with Dashboard for Agent ... [OK]
Creating Agent Token ... [OK]
Creating Kubernetes Secret with Agent Token ... [FAILED]
command failed with "exit status 64" and output:
error: unknown command "create", see 'snap help'.
What is the expected correct behavior?
The command should go ahead step 6, 7 and 8 to finish creating the agent.
Relevant logs and/or screenshots
Debug mode:
DEBUG=TRUE glab cluster agent bootstrap agentname --manifest-path clusters/microk8s
[git remote -v]
[git config --get-regexp ^remote\..*\.glab-resolved$]
[git remote -v]
[git config --get-regexp ^remote\..*\.glab-resolved$]
[git remote -v]
[git config --get-regexp ^remote\..*\.glab-resolved$]
[git remote -v]
[git config --get-regexp ^remote\..*\.glab-resolved$]
Registering Agent ... [OK]
Configuring Agent ... [OK]
Configuring Environment with Dashboard for Agent ... [OK]
Creating Agent Token ... [OK]
Creating Kubernetes Secret with Agent Token ... [FAILED]
command failed with "exit status 64" and output:
error: unknown command "create", see 'snap help'.
Possible fixes
The used of microk8s seems to be the origin of the bug.
I tried creating the secret by my own using the following command and then try again but it not worked.
kubectl create secret generic gitlab-agent-token --from-literal=token=<your-agent-token>
I wonder if there is a way to do this steps manually or skip it and only do what folows.