code.gitea.io/gitea@v1.22.3/docs/content/installation/on-kubernetes.zh-cn.md (about)

     1  ---
     2  date: "2020-03-19T19:27:00+02:00"
     3  title: "在 Kubernetes 中安装 Gitea"
     4  slug: "install-on-kubernetes"
     5  sidebar_position: 80
     6  toc: false
     7  draft: false
     8  aliases:
     9    - /zh-cn/install-on-kubernetes
    10  menu:
    11    sidebar:
    12      parent: "installation"
    13      name: "在 Kubernetes 中安装 Gitea"
    14      sidebar_position: 80
    15      identifier: "install-on-kubernetes"
    16  ---
    17  
    18  # 使用 Helm 在 Kubernetes 云原生环境中安装 Gitea
    19  
    20  Gitea 已经提供了便于在 Kubernetes 云原生环境中安装所需的 Helm Chart
    21  
    22  默认安装指令为:
    23  
    24  ```bash
    25  helm repo add gitea https://dl.gitea.com/charts
    26  helm repo update
    27  helm install gitea gitea/gitea
    28  ```
    29  
    30  如果采用默认安装指令,Helm 会部署单实例的 Gitea, PostgreSQL, Memcached。若您想实现自定义安装(包括配置 Gitea 集群、NGINX Ingress、MySQL、MariaDB、持久存储等),请前往阅读:[Gitea Helm Chart](https://gitea.com/gitea/helm-chart/)
    31  
    32  您也可以通过 `helm show` 命令导出 `README.md` 和配置文件 `values.yaml` 进行学习和编辑,例如:
    33  
    34  ```bash
    35  helm show values gitea/gitea > values.yaml
    36  helm show readme gitea/gitea > README.md
    37  
    38  # 使用自定义的配置文件 values.yaml
    39  helm install gitea -f values.yaml gitea/gitea
    40  ```
    41  
    42  ## 运行状况检查接口
    43  
    44  Gitea 附带了一个运行状况检查接口 `/api/healthz`,你可以像这样在 Kubernetes 中配置它:
    45  
    46  ```yaml
    47    livenessProbe:
    48      httpGet:
    49        path: /api/healthz
    50        port: http
    51      initialDelaySeconds: 200
    52      timeoutSeconds: 5
    53      periodSeconds: 10
    54      successThreshold: 1
    55      failureThreshold: 10
    56  ```
    57  
    58  成功的运行状况检查响应代码为 HTTP `200`,下面是示例:
    59  
    60  ```
    61  HTTP/1.1 200 OK
    62  
    63  {
    64    "status": "pass",
    65    "description": "Gitea: Git with a cup of tea",
    66    "checks": {
    67      "cache:ping": [
    68        {
    69          "status": "pass",
    70          "time": "2022-02-19T09:16:08Z"
    71        }
    72      ],
    73      "database:ping": [
    74        {
    75          "status": "pass",
    76          "time": "2022-02-19T09:16:08Z"
    77        }
    78      ]
    79    }
    80  }
    81  ```
    82  
    83  有关更多信息,请参考 Kubernetes 文档 [配置存活、就绪和启动探测器](https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)