Skip to content

Commit 79ba6e6

Browse files
committed
update docs
1 parent 5a81df2 commit 79ba6e6

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- [常用函数](other/prometheus/prometheus-query.md)
4343
- [标签自定义配置](other/prometheus/relabel_configs.md)
4444
- [Grafana 模版变量](other/prometheus/grafana.md)
45+
- [Grafana 自定义配置](other/prometheus/grafana_subpath.md)
4546
- [故障排查](other/prometheus/troubleshooting.md)
4647
- [kubelet Job 丢失](other/prometheus/kubelet-job-missing.md)
4748
- [AI 生成]()
@@ -58,6 +59,8 @@
5859

5960
- [Gitlab]()
6061
- [安装](other/gitlab/gitlab_install.md)
62+
- [operator_install_gitlab](other/gitlab/operator_install_gitlab.md)
63+
- [gitlab_subpath](other/gitlab/gitlab_subpath.md)
6164
- [Git 克隆 master 分支后将修改推送 dev 分支](other/gitlab/gitmaster-todev.md)
6265

6366
- [Helm]()

src/other/gitlab/gitlab_subpath.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# gitlab 自定义 subpath
2+
3+
- 修改 gitlab.rb 配置文件
4+
5+
```yaml
6+
vi /etc/gitlab/gitlab.rb
7+
8+
external_url: http://192.168.0.110:32255/gitlab # 这里配置修改下即可,或者是不是有环境变量可以替换
9+
10+
http://192.168.0.110:32255/gitlab
11+
http 协议 ip地址,这个也就是后续外部访问时的IP/域名、端口 、子路径就是 /gitlab,后续 gitlab 就会以该端口对外暴露
12+
```
13+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# 使用 operator 部署 gitlab
2+
3+
## operator 安装
4+
5+
```shell
6+
kubectl create namespace gitlab-system
7+
```
8+
9+
- gitlab-operator 地址
10+
11+
```shell
12+
https://gitlab.com/gitlab-org/cloud-native/gitlab-operator/-/releases?after=eyJyZWxlYXNlZF9hdCI6IjIwMjUtMDEtMTYgMTQ6Mjc6MjAuMTM5NTk0MDAwICswMDAwIiwiaWQiOiIxNTU1NjE4OSJ9
13+
```
14+
15+
- Install-operator
16+
17+
```shell
18+
[root@controller-node-1 ~]# kubectl apply -f gitlab-operator.yaml
19+
customresourcedefinition.apiextensions.k8s.io/gitlabs.apps.gitlab.com created
20+
serviceaccount/gitlab-app-nonroot created
21+
serviceaccount/gitlab-manager created
22+
serviceaccount/gitlab-nginx-ingress created
23+
serviceaccount/gitlab-prometheus-server created
24+
clusterrole.rbac.authorization.k8s.io/gitlab-app-role-nonroot created
25+
clusterrole.rbac.authorization.k8s.io/gitlab-metrics-auth-role created
26+
clusterrole.rbac.authorization.k8s.io/gitlab-metrics-reader created
27+
clusterrole.rbac.authorization.k8s.io/gitlab-manager-role created
28+
clusterrole.rbac.authorization.k8s.io/gitlab-nginx-ingress created
29+
clusterrole.rbac.authorization.k8s.io/gitlab-prometheus-server created
30+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-app-rolebinding-nonroot created
31+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-metrics-auth-rolebinding created
32+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-manager-rolebinding created
33+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-nginx-ingress created
34+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-prometheus-server created
35+
role.rbac.authorization.k8s.io/gitlab-leader-election-role created
36+
role.rbac.authorization.k8s.io/gitlab-nginx-ingress created
37+
rolebinding.rbac.authorization.k8s.io/gitlab-leader-election-rolebinding created
38+
rolebinding.rbac.authorization.k8s.io/gitlab-nginx-ingress created
39+
service/gitlab-controller-manager-metrics-service created
40+
service/gitlab-webhook-service created
41+
deployment.apps/gitlab-controller-manager created
42+
ingressclass.networking.k8s.io/gitlab-nginx created
43+
validatingwebhookconfiguration.admissionregistration.k8s.io/gitlab-validating-webhook-configuration created
44+
resource mapping not found for name: "gitlab-serving-cert" namespace: "gitlab-system" from "gitlab-operator.yaml": no matches for kind "Certificate" in version "cert-manager.io/v1"
45+
ensure CRDs are installed first
46+
resource mapping not found for name: "gitlab-selfsigned-issuer" namespace: "gitlab-system" from "gitlab-operator.yaml": no matches for kind "Issuer" in version "cert-manager.io/v1"
47+
ensure CRDs are installed first
48+
49+
# 安装报错,它依赖 cert-manager 组件,估计是跟 https 有关系
50+
51+
# 再次安装过了
52+
[root@controller-node-1 ~]# kubectl apply -f gitlab-operator.yaml
53+
customresourcedefinition.apiextensions.k8s.io/gitlabs.apps.gitlab.com configured
54+
serviceaccount/gitlab-app-nonroot unchanged
55+
serviceaccount/gitlab-manager unchanged
56+
serviceaccount/gitlab-nginx-ingress unchanged
57+
serviceaccount/gitlab-prometheus-server unchanged
58+
clusterrole.rbac.authorization.k8s.io/gitlab-app-role-nonroot unchanged
59+
clusterrole.rbac.authorization.k8s.io/gitlab-metrics-auth-role unchanged
60+
clusterrole.rbac.authorization.k8s.io/gitlab-metrics-reader unchanged
61+
clusterrole.rbac.authorization.k8s.io/gitlab-manager-role unchanged
62+
clusterrole.rbac.authorization.k8s.io/gitlab-nginx-ingress unchanged
63+
clusterrole.rbac.authorization.k8s.io/gitlab-prometheus-server unchanged
64+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-app-rolebinding-nonroot unchanged
65+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-metrics-auth-rolebinding unchanged
66+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-manager-rolebinding unchanged
67+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-nginx-ingress unchanged
68+
clusterrolebinding.rbac.authorization.k8s.io/gitlab-prometheus-server unchanged
69+
role.rbac.authorization.k8s.io/gitlab-leader-election-role unchanged
70+
role.rbac.authorization.k8s.io/gitlab-nginx-ingress unchanged
71+
rolebinding.rbac.authorization.k8s.io/gitlab-leader-election-rolebinding unchanged
72+
rolebinding.rbac.authorization.k8s.io/gitlab-nginx-ingress unchanged
73+
service/gitlab-controller-manager-metrics-service unchanged
74+
service/gitlab-webhook-service unchanged
75+
deployment.apps/gitlab-controller-manager unchanged
76+
ingressclass.networking.k8s.io/gitlab-nginx unchanged
77+
certificate.cert-manager.io/gitlab-serving-cert created
78+
issuer.cert-manager.io/gitlab-selfsigned-issuer created
79+
validatingwebhookconfiguration.admissionregistration.k8s.io/gitlab-validating-webhook-configuration configured
80+
```
81+
82+
## install-gitlab
83+
84+
```shell
85+
apiVersion: apps.gitlab.com/v1beta1
86+
kind: GitLab
87+
metadata:
88+
name: gitlab
89+
spec:
90+
chart:
91+
version: "1.6.0"
92+
values:
93+
global:
94+
hosts:
95+
domain: mawb.gitlab.com
96+
ingress:
97+
configureCertmanager: true
98+
certmanager-issuer:
99+
100+
```
101+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Grafana 子路径
2+
3+
- 在使用代理的场景下,可能会涉及到子路径的问题,因为同意域名下面不能有多个 /,否则会导致转发失败
4+
5+
- k8s ingress 规则中,同一个域名也会出现上面的问题,其本质是一个问题
6+
- 提交允许换个域名即可
7+
8+
# 如何配置
9+
10+
```ini
11+
# If you use reverse proxy and sub path specify full url (with sub path)
12+
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
13+
14+
# Serve Grafana from subpath specified in `root_url` setting. By default it
15+
is set to `false` for compatibility reasons.
16+
serve_from_sub_path = true
17+
```
18+
19+
- /grafana/ 在这里是加入的 uri 子路径

0 commit comments

Comments
 (0)