I have created a simple project with a CDK8S structure so that I can run Infrastructure as Code.
This project consists of an npm run build
and kubectl apply -f <dist/>
. I followed the indications in the Docs about ‘Using a GitLab CI/CD workflow for Kubernetes’. These are the steps I took (note that these are ALL in the same project):
First I created an agent configuration in the path .gitlab/agents/agent1/config.yaml
:
observability:
logging:
level: debug
I saw this on an online tutorial I followed and seemed correct, at least I would get more information.
Then I created this very simple .gitlab-ci.yml
file:
deploy:
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
- kubectl config get-contexts
- kubectl config use-context rafaelmoreira1180778/home-media-center:agent1
- kubectl get pods
The project itself is under rafaelmoreira1180778/home-media-center
, since the url for the .gitlab-ci.yml
file is https://gitlab.com/rafaelmoreira1180778/home-media-center/-/blob/master/.gitlab-ci.yml
.
The pipeline than triggers but is stuck in the state ‘pending’ with this warning: This job is stuck because you don't have any active runners that can run this job.
.
From the documentation above mentioned this should be it, the Agent, from what I understand, should provide the needed runners for the pipelines so what am I missing?
These are the logs and outputs of my agent installation:
$ kubectl get all -o wide -n gitlab-kubernetes-agent
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/gitlab-agent-c67d7bf96-5lbzv 1/1 Running 0 36m 10.1.57.82 bigbrainserver <none> <none>
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
deployment.apps/gitlab-agent 1/1 1 1 36m agent registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk:stable app=gitlab-agent
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/gitlab-agent-c67d7bf96 1 1 1 36m agent registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/agentk:stable app=gitlab-agent,pod-template-hash=c67d7bf96
pod/gitlab-agent-c67d7bf96-5lbzv
logs:
{"level":"info","time":"2022-03-03T11:47:55.609Z","msg":"Observability endpoint is up","mod_name":"observability","net_network":"tcp","net_address":"[::]:8080"}
{"level":"debug","time":"2022-03-03T11:49:56.101Z","msg":"Applying configuration","commit_id":"f31ac16ae98c9ea39d1f85d06118b566f9fda17a","agent_config":{"observability":{"logging":{"level":1}},"agent_id":8819,"project_id":33497622}}
{"level":"debug","time":"2022-03-03T11:50:16.168Z","msg":"Applying configuration","commit_id":"08e2fd162735a1ef0d2a4866d4914a11519a975a","agent_config":{"observability":{"logging":{"level":1}},"agent_id":8819,"project_id":33497622}}
{"level":"debug","time":"2022-03-03T12:03:36.940Z","msg":"Applying configuration","commit_id":"f10c5a0170168360a757f07a1fefe581fb6d40d2","agent_config":{"observability":{"logging":{"level":1}},"agent_id":8819,"project_id":33497622}}
{"level":"debug","time":"2022-03-03T12:10:26.226Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:31.078Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:33.354Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:39.044Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:48.917Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:49.440Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:10:49.610Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:11:16.504Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:11:24.127Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
{"level":"debug","time":"2022-03-03T12:11:31.309Z","msg":"Handled a connection successfully","mod_name":"reverse_tunnel"}
I can see (I assume, at least) that my configuration is being picked up correctly since I have debug
instructions on the logs…
What am I missing here? Why is this happening?