aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/doc/installation/on-kubernetes.zh-cn.md
blob: 84f55030b3ff7b231afc4aa9de4442c190ad24d4 (plain)
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
---
date: "2020-03-19T19:27:00+02:00"
title: "在 Kubernetes 安装 Gitea"
slug: "install-on-kubernetes"
weight: 10
toc: false
draft: false
menu:
  sidebar:
    parent: "installation"
    name: "Kubernetes"
    weight: 50
    identifier: "install-on-kubernetes"
---

# 使用 Helm 在 Kubernetes 云原生环境中安装 Gitea

Gitea 已经提供了便于在 Kubernetes 云原生环境中安装所需的 Helm Chart

默认安装指令为:

```bash
helm repo add gitea https://dl.gitea.io/charts
helm repo update
helm install gitea gitea/gitea
```

如果采用默认安装指令,Helm 会部署单实例的 Gitea, PostgreSQL, Memcached。若您想实现自定义安装(包括配置 Gitea 集群、NGINX Ingress、MySQL、MariaDB、持久存储等),请前往阅读:[Gitea Helm Chart](https://gitea.com/gitea/helm-chart/)

您也可以通过 `helm show` 命令导出 `README.md` 和配置文件 `values.yaml` 进行学习和编辑,例如:

```bash
helm show values gitea > values.yaml
helm show readme gitea > README.md

# 使用自定义的配置文件 values.yaml
helm install gitea -f values.yaml gitea/gitea
```

## 运行状况检查接口

Gitea 附带了一个运行状况检查接口 `/api/healthz`,你可以像这样在 Kubernetes 中配置它:

```yaml
  livenessProbe:
    httpGet:
      path: /api/healthz
      port: http
    initialDelaySeconds: 200
    timeoutSeconds: 5
    periodSeconds: 10
    successThreshold: 1
    failureThreshold: 10
```

成功的运行状况检查响应代码为 HTTP `200`,下面是示例:

```
HTTP/1.1 200 OK


{
  "status": "pass",
  "description": "Gitea: Git with a cup of tea",
  "checks": {
    "cache:ping": [
      {
        "status": "pass",
        "time": "2022-02-19T09:16:08Z"
      }
    ],
    "database:ping": [
      {
        "status": "pass",
        "time": "2022-02-19T09:16:08Z"
      }
    ]
  }
}
```

有关更多信息,请参考 Kubernetes 文档 [配置存活、就绪和启动探测器](https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)