1

kubernetes搭建drone

 3 years ago
source link: https://www.bboy.app/2021/07/13/kubernetes%E6%90%AD%E5%BB%BAdrone/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

kubernetes搭建drone

发表于

2021-07-13 分类于 kubernetes

20210713092656.png

我还是很喜欢gitlab的,但是gitlab太重了,不适合自己一个人使用,所以gitea加drone是个人使用最好的方案,我是这么认为的

首先你需要在gitea上创建一个应用好让drone去接入gitea

怎么创建应用就不说了,创建完成应用完成之后会获得

DRONE_GITEA_CLIENT_ID

DRONE_GITEA_CLIENT_SECRET

这两个参数

之后就是drone的事情了

重定向url就是drone的地址,注意后面一定要加上login

https://drone.bboysoul.cn/login

之后就是看drone的yaml文件

apiVersion: v1
kind: Namespace
metadata:
name: drone
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: drone
namespace: drone
spec:
selector:
matchLabels:
app: drone
serviceName: drone
replicas: 1
template:
metadata:
labels:
app: drone
spec:
containers:
- name: drone
image: registry.bboysoul.cn/drone/drone:2.0.2
env:
- name: DRONE_GITEA_CLIENT_ID
value: "d4as6d57-7z6a-40ce-80e9-432eas6dc3f2"
- name: DRONE_GITEA_CLIENT_SECRET
value: "Uvio1mOouasssssepC7itAgiRfjLI8PIeOJBMarec2V9E="
- name: DRONE_GITEA_SERVER
value: "https://git.bboysoul.cn"
- name: DRONE_GIT_ALWAYS_AUTH
value: "true"
- name: DRONE_RPC_SECRET
value: "ff57e2700cdasd4a2fbeaffds7efe22da"
- name: DRONE_SERVER_HOST
value: "drone.bboysoul.cn"
- name: DRONE_SERVER_PROTO
value: "https"
ports:
- containerPort: 80
name: http
- containerPort: 443
name: https
volumeMounts:
- name: data
mountPath: /data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Gi
storageClassName: "managed-nfs-storage"

---

apiVersion: v1
kind: Service
metadata:
name: drone
namespace: drone
spec:
type: LoadBalancer
selector:
app: drone
ports:
- port: 80
targetPort: 80
name: http
- port: 443
targetPort: 443
name: https

也就是一个ns 一个sts 一个service,关键就是sts上面的env参数

DRONE_GITEA_SERVER这个是gitea的地址

DRONE_RPC_SECRET 这个是rpc secret 使用openssl rand -hex 16随便创建一个

DRONE_SERVER_HOST 这个是drone的地址

DRONE_SERVER_PROTO 表示drone使用什么协议

之后apply上面的东西就好了

当你登陆访问drone的时候会自动跳转到gitea,然后登陆gitea就可以登陆drone了

欢迎关注我的博客www.bboy.app

Have Fun


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK