GitLab App

Objective

This tutorial shows you how to quickly deploy a GitLab application using templates from KubeSphere Helm repo. The demonstration includes importing application repository, sharing and deploying apps within a workspace.

Prerequisites

  • You have enabled OpenPitrix.
  • You have completed the tutorial Create Workspace, Project, Account and Role. The account needs to be a platform regular user and to be invited as the project operator with the operator role. In this tutorial, we’ll work in the project apps of the workspace apps.

Hands-on Lab

Step 1: Add an Application Repository

1.1. Sign in as workspace admin account (apps-admin for this guide), click View Workspace and navigate to Apps Management → App Repos, then click Add Repo.

Add Repo

1.2. Fill in the basic information, name it main and input the URL https://charts.kubesphere.io/main. You can validate if this URL is available, and choose OK when you have done.

备注

It will automatically import all of the applications from the Helm repository into KubeSphere. You can browse those app templates in each project.

Add KS Repo

Step 2: Browse App Templates

2.1. Switch to use workspace regular account to log in (apps-regular for this guide), then enter into project apps.

2.2. Click Application Workloads → Applications, click Deploy New Application.

Deploy App

2.3. Choose From App Templates and select main from the dropdown list. Click gitlab.

Deploy GitLab

Step 3: Deploy GitLab Application

3.1. Click Deploy at the top right, customize app name if needed, and then click Next.

Deploy GitLab Info

3.2. Customize App Config, and then click Deploy.

Generally we need to customize the domain name, and we’ll use apps.svc.cluster.local here, which follows K8s internal DNS suffix for in-cluster access (the leading apps means the project apps, you can use your own project name accordingly).

  1. global:
  2. hosts:
  3. domain: apps.svc.cluster.local
  4. gitlab-runner:
  5. install: false
  6. gitlab:
  7. webservice:
  8. helmTests:
  9. enabled: false

GitLab configuration

3.3. Wait for a few minutes, then you will see the application git showing active in the application list.

GitLab Active

Step 4: Expose GitLab Service

Set up a record gitlab.<project>.svc.<k8s domain> in the DNS server, or simply put it in hosts file.

  1. 172.24.2.3 gitlab.apps.svc.cluster.local

备注

  • The hosts file is /etc/hosts for Linux or c:\windows\system32\drivers\etc\hosts for Windows.
  • You can use the IP address of any K8s master/worker node.

Step 5: Access the GitLab Service

5.1. Enter kubectl CLI by clicking the button in popup menu at the right bottom of KubeSphere console.

kubectl

5.2. Retrieve and decode the root user’s password.

  1. kubectl -n apps get secrets git-gitlab-initial-root-password -o jsonpath="{.data.password}" | base64 -d; echo

GitLab Password

5.3. Find the port of Nginx.

Nginx Port

5.4. Accessed GitLab http://gitlab.apps.svc.cluster.local:<nginx port> with the password.

Sign in GitLab