GitLab CI with Kubernetes

Implementing CI/CD for your software development cycle is almost a must nowadays. Let’s see how you can implement the CI/CD flow with GitLab CI and integrate the CI into your Kubernetes cluster.

Donald Le
Automation with Love

--

Photo by Alex Mesmer on Unsplash

With GitLab CI, you have two options : pull-base (aka — the GitOps way) vs push-base. As a GitLab best practice, and also more supported way, pull-base is recommended.

To implement the pull-base approach, you need to set up your GitLab agent.

GitLab agent
The GitLab Agent should be on the same or higher level than the project code you want to access later.

  • From the GitLab GUI of the test-gitlab-agent project, choose Infrastructure > Kubernetes clusters.
  • Choose Connect a cluster, then choose the agent to configure. You should be able to see the suggested code that installs the GitLab agent into the Kubernetes cluster
helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install gitlab-agent gitlab/gitlab-agent \
--set config.kasAddress='wss://kas.gitlab.example.com' \
--set config.token='YOUR.AGENT.TOKEN'

Test service

--

--

Donald Le
Automation with Love

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.