GitLab agent for Rancher2
Published in
3 min readOct 6, 2022
How to add GitLab agent for Kubernetes cluster in Rancher2?
Add new empty .gilab/agents/uniqname/config.yaml
file like this:
Connect new agent:
Now you need to add new app in your project in Rancher.
Add new catalog in “Manage Catalogs” in Rancher.
Launch new app in project
Fill “Variable” from agent settings and launch app
image.tag=v15.4.0config.token=n…………Kwconfig.kasAddress=wss://kas.gitlab.com
Result:
Add new variable in CI/CD
KUBE_CONTEXT = group/project/agentname
Change your Kubernetes deploy in .yaml
.kubic_job: &kubic_job
image:
name: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v1.6.1"
before_script:
- chmod 400 "$KUBECONFIG" # Workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/327912
- gl-use-kube-context
And example work:
deploy_test:
<<: *kubic_job
stage: test
variables:
KUBE_NAMESPACE: "gitlab-agent"
script:
- kubectl config get-contexts
- kubectl version
Push gitlab config. Finish.
Thank you for reading!
Share and try my player for Apple Music — meows.app