k8s gitlab

先创建pv

gitlab-pv.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# gitlab redis pv
apiVersion: v1
kind: PersistentVolume
metadata:
name: gitlab-redis-pv
labels:
release: "gitlab-redis-pv"
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
path: /soyuan/k8s/data/gitlab/redis
server: 172.16.100.224
---

# gitlab postgresql pv
apiVersion: v1
kind: PersistentVolume
metadata:
name: gitlab-postgresql-pv
labels:
release: "gitlab-postgresql-pv"
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
path: /soyuan/k8s/data/gitlab/postgresql
server: 172.16.100.224
---

# gitlab pv
apiVersion: v1
kind: PersistentVolume
metadata:
name: gitlab-pv
labels:
release: "gitlab-pv"
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
path: /soyuan/k8s/data/gitlab/gitlab
server: 172.16.100.224

gitlab-pvc.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitlab-redis-pvc
namespace: devops
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
selector:
matchLabels:
release: "gitlab-redis-pv"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitlab-postgresql-pvc
namespace: devops
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
selector:
matchLabels:
release: "gitlab-postgresql-pv"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitlab-pvc
namespace: devops
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
selector:
matchLabels:
release: "gitlab-pv"

gitlab-devops-namespace.yaml

1
2
3
4
apiVersion: v1
kind: Namespace
metadata:
name: devops

gitlab-redis.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitlab-redis
namespace: devops
labels:
name: gitlab-redis
spec:
replicas: 1
selector:
matchLabels:
name: gitlab-redis
template:
metadata:
name: gitlab-redis
labels:
name: gitlab-redis
spec:
nodeSelector:
type: public
containers:
- name: gitlab-redis
image: sameersbn/redis
imagePullPolicy: IfNotPresent
ports:
- name: gitlab-redis
containerPort: 6379
hostPort: 6379
volumeMounts:
- mountPath: /var/lib/redis
name: data
livenessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 5
timeoutSeconds: 1
volumes:
- name: data
persistentVolumeClaim:
claimName: gitlab-redis-pvc

gitlab-postgresql.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitlab-postgresql
namespace: devops
labels:
name: gitlab-postgresql
spec:
replicas: 1
selector:
matchLabels:
name: gitlab-postgresql
template:
metadata:
name: gitlab-postgresql
labels:
name: gitlab-postgresql
spec:
nodeSelector:
type: public
containers:
- name: gitlab-postgresql
image: sameersbn/postgresql
imagePullPolicy: IfNotPresent
env:
- name: DB_USER
value: gitlab
- name: DB_PASS
value: soyuan.123
- name: DB_NAME
value: gitlab_production
- name: DB_EXTENSION
value: pg_trgm,btree_gist
ports:
- name: postgres
containerPort: 5432
hostPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql
name: data
livenessProbe:
exec:
command:
- pg_isready
- -h
- localhost
- -U
- postgres
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- pg_isready
- -h
- localhost
- -U
- postgres
initialDelaySeconds: 5
timeoutSeconds: 1
volumes:
- name: data
persistentVolumeClaim:
claimName: gitlab-postgresql-pvc

gitlab.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitlab
namespace: devops
labels:
name: gitlab
spec:
replicas: 1
selector:
matchLabels:
name: gitlab
template:
metadata:
name: gitlab
labels:
name: gitlab
spec:
nodeSelector:
type: public
hostNetwork: true
containers:
- name: gitlab
image: sameersbn/gitlab:14.6.2
imagePullPolicy: IfNotPresent
env:
- name: TZ
value: Asia/Shanghai
- name: GITLAB_TIMEZONE
value: Beijing
- name: GITLAB_SECRETS_DB_KEY_BASE
value: long-and-random-alpha-numeric-string
- name: GITLAB_SECRETS_SECRET_KEY_BASE
value: long-and-random-alpha-numeric-string
- name: GITLAB_SECRETS_OTP_KEY_BASE
value: long-and-random-alpha-numeric-string
- name: GITLAB_ROOT_PASSWORD
value: soyuan.123
- name: GITLAB_ROOT_EMAIL
value: chenc@soyuan.com.cn
- name: GITLAB_HOST
value: gitlab.soyuan.com.cn
- name: GITLAB_PORT
value: "80"
- name: GITLAB_SSH_PORT
value: "22"
- name: GITLAB_NOTIFY_ON_BROKEN_BUILDS
value: "true"
- name: GITLAB_NOTIFY_PUSHER
value: "false"
- name: GITLAB_BACKUP_SCHEDULE
value: daily
- name: GITLAB_BACKUP_TIME
value: 01:00
- name: DB_TYPE
value: postgres
- name: DB_HOST
value: 172.16.100.224
- name: DB_PORT
value: "5432"
- name: DB_USER
value: gitlab
- name: DB_PASS
value: soyuan.123
- name: DB_NAME
value: gitlab_production
- name: REDIS_HOST
value: 172.16.100.224
- name: REDIS_PORT
value: "6379"


- name: LDAP_ENABLED
value: "true"
- name: LDAP_LABEL
value: 'soyuan LDAP'
- name: LDAP_HOST
value: '172.20.10.105'
- name: LDAP_PORT
value: '636'
- name: LDAP_UID
value: 'sAMAccountName'
- name: LDAP_BIND_DN
value: 'query@soyuan.com.cn'
- name: LDAP_PASS
value: 'cQ3@46VTJAVG'
- name: LDAP_BASE
value: 'CN=Person,CN=Schema,CN=Configuration,DC=soyuan,DC=com,DC=cn'
- name: LDAP_ALLOW_USERNAME_OR_EMAIL_LOGIN
value: "true"
- name: LDAP_VERIFY_SSL
value: 'true'
- name: LDAP_METHOD
value: ''
ports:
- name: http
containerPort: 80
- name: ssh
containerPort: 22
volumeMounts:
- mountPath: /home/git/data
name: data
# livenessProbe:
# httpGet:
# path: /
# port: 80
# initialDelaySeconds: 180
# timeoutSeconds: 5
# readinessProbe:
# httpGet:
# path: /
# port: 80
# initialDelaySeconds: 5
# timeoutSeconds: 1
volumes:
- name: data
persistentVolumeClaim:
claimName: gitlab-pvc

k8s gitlab
https://zhaops-hub.github.io/2021/11/24/k8s/k8s gitlab/
作者
赵培胜
发布于
2021年11月24日
许可协议