You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

on-kubernetes.zh-cn.md 2.1KB

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