6.3 KiB
| title | keywords | description | linkTitle | weight |
|---|---|---|---|---|
| Deploy GitLab on KubeSphere | KubeSphere, Kubernetes, GitLab, App Store | Learn how to deploy GitLab on KubeSphere and access its service. | Deploy GitLab on KubeSphere | 14310 |
GitLab is an open-source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more.
This tutorial demonstrates how to deploy GitLab on KubeSphere.
Prerequisites
- You need to enable the OpenPitrix system.
- You need to create a workspace, a project, and two accounts (
ws-adminandproject-regular) for this tutorial. The accountws-adminmust be granted the role ofworkspace-adminin the workspace, and the accountproject-regularmust be invited to the project with the role ofoperator. If they are not ready, refer to Create Workspaces, Projects, Accounts and Roles.
Hands-on Lab
Step 1: Add an app repository
-
Log in to KubeSphere as
ws-admin. In your workspace, go to App Repositories under App Management, and then click Add. -
In the displayed dialog box, enter
mainfor the app repository name andhttps://charts.kubesphere.io/mainfor the app repository URL. Click Validate to verify the URL and you will see a green check mark next to the URL if it is available. Click OK to continue. -
The repository is displayed in the list after successfully imported to KubeSphere.
Step 2: Deploy GitLab
-
Log out of KubeSphere and log back in as
project-regular. In your project, go to Apps under Application Workloads and click Deploy New App. -
In the displayed dialog box, select From App Templates.
-
Select
mainfrom the drop-down list, then click gitlab. -
On the App Information tab and the Chart Files tab, you can view the default configuration from the console. Click Deploy to continue.
-
On the Basic Information page, you can view the app name, app version, and deployment location. This tutorial uses the version
4.2.3 [13.2.2]. Click Next to continue. -
On the App Configurations page, use the following configurations to replace the default configurations, and then click Deploy.
global: hosts: domain: demo-project.svc.cluster.local gitlab-runner: install: false gitlab: webservice: helmTests: enabled: false{{< notice note >}}
demo-projectrefers to the project name where GitLab is deployed. Make sure you use your own project name.{{</ notice >}}
-
Wait for GitLab to be up and running.
-
Go to Workloads, and you can see all the Deployments and StatefulSets created for GitLab.
{{< notice note >}}
It may take a while before all the Deployments and StatefulSets are up and running.
{{</ notice >}}
Step 3: Get the root user's password
-
Go to Secrets under Configurations, enter
gitlab-initial-root-passwordin the search box, and then press Enter on your keyboard to search the Secret. -
Click the Secret to go to its detail page, and then click
in the upper-right corner to view the password. Make sure you copy it.
Step 4: Edit the hosts file
-
Find the hosts file on your local machine.
{{< notice note >}}
The path of hosts file is
/etc/hostsfor Linux, orc:\windows\system32\drivers\etc\hostsfor Windows.{{</ notice >}}
-
Add the following item into the hosts file.
192.168.4.3 gitlab.demo-project.svc.cluster.local{{< notice note >}}
192.168.4.3anddemo-projectrefer to the NodeIP and project name respectively where GitLab is deployed. Make sure you use your own NodeIP and project name.- You can use any IP address of the nodes in your Kubernetes cluster.
{{</ notice >}}
Step 5: Access GitLab
-
Go to Services under Application Workloads, enter
nginx-ingress-controllerin the search box, and then press Enter on your keyboard to search the Service. You can see the Service is being exposed through port31246, which you can use to access GitLab.{{< notice note >}}
The port number shown on your console may be different. Make sure you use your own port number.
{{</ notice >}}
-
Access GitLab through
http://gitlab.demo-project.svc.cluster.local:31246using the root account and its initial password (root/ojPWrWECLWN0XFJkGs7aAqtitGMJlVfS0fLEDE03P9S0ji34XDoWmxs2MzgZRRWF).{{< notice note >}}
You may need to open the port in your security groups and configure related port forwarding rules depending on where your Kubernetes cluster is deployed.
{{</ notice >}}
















