Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install drone and associate gitlab with rancher

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces in detail the method of installing drone with rancher store and associating gitlab with drone. The detailed explanation of picture and text is easy to learn and is very suitable for beginners. Interested friends can refer to it.

1 the environment of this paper is k8s v1.16.3 Grancher v2.3.3.

2 create a gitlab Oauth application

Log in to gitlab and select setting:

Select "application" and fill in the relevant information. Redirect URI is the callback drone server address (it will be installed below, so it doesn't matter here. My address is http://jiuxi.drone.org/login, note that / login is a must suffix, don't forget to write).

After saving, the authorization information is generated as follows:

End of gitlab configuration.

3 create secret

First, create a secret through kubelet, where the "clientSecret" value is the secret value of the oauth application created by the above gitlab:

Kubectl create secret generic drone-server-secrets\

-- namespace=drone\

-from-literal=clientSecret= "93e85934b165566125bdc313288d79fb446c486d18afaf07f7c97e36297b00bd"

4 create project spaces and namespaces

Log in to rancher and select the specified cluster:

Click to enter jiuxi, you can see the dashboard of the cluster, and select "Project / Namespace":

Select add Project:

Fill in the project name (drone) and create:

Under the new project (drone), select add Namespace:

Fill in the namespace name (drone) and create:

The project space and namespace have been created. By navigating and clicking to enter, all future operations will be carried out under this project space.

5 install nfs server

The reason for installing the nfs server is that drone requires storage space, so nfs is used here. How to install nfs server, please refer to my "easy to complete nfs installation", do not worry, simple and easy, let you finish easily in minutes.

Mkdir-p / data/nfs/drone/1g

Chmod 777-R / data/nfs/drone/1g

Echo "/ data/nfs/drone 10.110.0.0 echo 16 (rw,sync,no_root_squash)" > > / etc/exports

Systemctl restart nfs

6 create pv

Edit the pv-drone-1g.yaml file, where the server address is the address of the nfs server:

ApiVersion: v1

Kind: PersistentVolume

Metadata:

Name: pv-drone-1g

Spec:

Capacity:

Storage: 1Gi

VolumeMode: Filesystem

AccessModes:

-ReadWriteOnce

PersistentVolumeReclaimPolicy: Retain

Nfs:

Server: 10.110.101.106

Path: / data/nfs/drone/1g

Create a pv:

Kubectl apply-f pv-drone-1g.yaml

7 create pvc

Edit the pvc-drone-1g.yaml file:

ApiVersion: v1

Kind: PersistentVolumeClaim

Metadata:

Name: pvc-drone-1g

Namespace: drone

Spec:

AccessModes:

-ReadWriteOnce

Resources:

Requests:

Storage: 1Gi

VolumeMode: Filesystem

Create a pvc:

Kubectl apply-f pvc-drone-1g.yaml

Since the pv is created first, and then the pvc is created, the pvc status is queried and it is found that the pvc has been successfully bound to the pv:

8 add drone to the App Store

Go to the App Store under the project space (drone) and select "start":

Search to find "drone":

Click and take a screenshot as follows:

"Drone settings" configuration content:

The explanation is as follows:

Drone Host Name: drone hostname

Set Drone Admin User: the gitlab user name above when the gitlab oauth was created

Drone integration Server: code repository type, I am gitlab

Secret created with kubectl on Select the Existing Drone Provider Secret;

GitLab OAuth3 Client ID: clientID of gitlab oauth

GitLab Server Address: gitlab warehouse address

"Service and Load balance" configuration content:

Because I installed nginx-ingress, I used load balance. For more information about how to install nginx-ingress, you can check out my related articles, which are simple enough to make you explode in minutes.

Click "start" after configuration. The following figure shows the status after successful startup. Sometimes the response of the page is not timely. You can refresh it several times to see the running status:

Click the "80/http" link in the figure above, and it will directly jump to the gitlab warehouse authorization page and select "Authorize":

The page will return to drone, and the page will synchronize your gitlab repository status. After the synchronization is completed, your gitlab repository code will be displayed:

The method described above is to install drone with rancher store and associate gitlab with drone, and the specific usage needs to be used in a hands-on experiment. If you want to know more about it, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report