Cloud Native 18 min read

Deploy GitLab CE on KubeSphere and Build CI/CD Pipelines – A Complete Guide

This tutorial walks you through installing KubeSphere, deploying GitLab Community Edition via Helm, configuring a minimal GitLab setup, creating a sample NodeJS project, disabling Auto DevOps, writing a Jenkinsfile, and linking GitLab with KubeSphere DevOps to run both scripted and graphical CI/CD pipelines, plus optional SSH access.

Qingyun Technology Community
Qingyun Technology Community
Qingyun Technology Community
Deploy GitLab CE on KubeSphere and Build CI/CD Pipelines – A Complete Guide

Prerequisites

Install KubeSphere

There are two ways to install KubeSphere: directly on Linux (see the official documentation) or on an existing Kubernetes cluster (see the official documentation).

Enable DevOps Suite in KubeSphere

Enable the DevOps suite via the documentation; after installation you will see the Jenkins icon in the System Components section of Platform Management.

KubeSphere’s DevOps system, built on Jenkins, provides a one‑stop solution for CI/CD workflows in Kubernetes, offering plugin management, Binary‑to‑Image (B2I), Source‑to‑Image (S2I), dependency caching, code quality analysis, and more.

Install GitLab CE

First create a workspace named devops and a project named gitlab for the GitLab CE deployment.

Add GitLab Helm Chart Repository

In the devops workspace, add the official GitLab Helm chart repository https://charts.gitlab.io/ via the Application Repository UI.

Create a GitLab application from the template, selecting version 5.7.0 (GitLab 14.7.0).

Configure only the minimal set of parameters needed for basic operation. See the full attribute list in the GitLab Helm chart documentation.

global:
  ## Ensure the edition is Community Edition
  edition: ce

  ## Global host configuration
  # Only bind the main GitLab service domain
  hosts:
    domain: example.com
    https: false
    gitlab:
      name: gitlab.example.com

  ## Global Ingress configuration
  ingress:
    configureCertmanager: false
    class: nginx
    tls:
      enabled: false

  ## Disable built‑in cert‑manager
  certmanager:
    installCRDs: false
    install: false

  ## Disable built‑in Nginx Ingress
  nginx-ingress:
    enabled: false

  ## Disable built‑in Registry
  registry:
    enabled: false

  ## Disable built‑in MinIO
  minio:
    ingress:
      enabled: false

  ## Disable built‑in GitLab Runner
  gitlab-runner:
    install: false

After deployment, check the gitlab workload status; it may show “Creating” due to timeout but will become runnable once all pods are ready.

If you have configured DNS for gitlab.example.com, you can access the GitLab UI directly.

Create a Sample Project in GitLab

Log in to GitLab using the initial root password stored in the secret gitlab-initial-root-password. Create a new project from the “NodeJS Express” template, set the visibility to Private, and import the code.

Disable Auto DevOps and Add a Jenkinsfile

Turn off Auto DevOps in the project settings. Then create a Jenkinsfile on the master branch with the following simple pipeline:

pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                echo 'Hello World'
            }
        }
    }
    post {
        always {
            echo 'I will always say Hello again!'
        }
    }
}

Use KubeSphere DevOps to Run the Pipeline

Create a DevOps project named demo in the devops workspace.

Bind GitLab to KubeSphere Jenkins

In Jenkins (namespace kubesphere-devops-system, service devops-jenkins), add a new GitLab server with the URL of your GitLab CE instance, a Personal Access Token credential (scopes: api, read_repository, write_repository), and enable “Manage Web Hooks”.

Create a Pipeline from the Jenkinsfile

In the demo project, create a new pipeline, select the GitLab repository root/nodejs-demo, choose the previously created credential, and let KubeSphere scan the Jenkinsfile. Run the pipeline and view logs and artifacts.

Build a Pipeline with the Graphical Editor

Alternatively, create a pipeline named gui without binding a repository, add a stage, then add a “git” step (using the HTTP URL of the sample repo and the gitlab-root credential) followed by a “print message” step with “Hello World!”. Save and run the pipeline.

Optional: Access GitLab Repository via SSH

Expose the gitlab-shell service with a NodePort and use an SSH URL such as ssh://[email protected]:32222/root/nodejs-demo.git for cloning and pushing.

Thank you for reading this tutorial. If you find the deployment challenging, consider using the commercial offerings of GitLab and KubeSphere Cloud to let professionals handle the setup.
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CI/CDKubernetesGitLabJenkinsHelmKubeSphere
Qingyun Technology Community
Written by

Qingyun Technology Community

Official account of the Qingyun Technology Community, focusing on tech innovation, supporting developers, and sharing knowledge. Born to Learn and Share!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.