本站源代码
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

108 lines
2.3KB

  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: gitea
  5. ---
  6. apiVersion: apps/v1
  7. kind: Deployment
  8. metadata:
  9. name: gitea
  10. namespace: gitea
  11. labels:
  12. app: gitea
  13. spec:
  14. replicas: 1
  15. template:
  16. metadata:
  17. name: gitea
  18. labels:
  19. app: gitea
  20. spec:
  21. containers:
  22. - name: gitea
  23. image: gitea/gitea:latest
  24. imagePullPolicy: Always
  25. volumeMounts:
  26. - mountPath: "/var/lib/gitea"
  27. name: "root"
  28. - mountPath: "/data"
  29. name: "data"
  30. ports:
  31. - containerPort: 22
  32. name: ssh
  33. protocol: TCP
  34. - containerPort: 3000
  35. name: http
  36. protocol: TCP
  37. restartPolicy: Always
  38. volumes:
  39. # Set up a data directory for gitea
  40. # For production usage, you should consider using PV/PVC instead(or simply using storage like NAS)
  41. # For more details, please see https://kubernetes.io/docs/concepts/storage/volumes/
  42. - name: "root"
  43. hostPath:
  44. # directory location on host
  45. path: "/var/lib/gitea"
  46. # this field is optional
  47. type: Directory
  48. - name: "data"
  49. hostPath:
  50. path: "/data/gitea"
  51. type: Directory
  52. selector:
  53. matchLabels:
  54. app: gitea
  55. ---
  56. # Using cluster mode
  57. apiVersion: v1
  58. kind: Service
  59. metadata:
  60. name: gitea-web
  61. namespace: gitea
  62. labels:
  63. app: gitea-web
  64. spec:
  65. ports:
  66. - port: 80
  67. targetPort: 3000
  68. name: http
  69. selector:
  70. app: gitea
  71. ---
  72. # Using node-port mode
  73. # This mainly open a specific TCP port for SSH usage on each host,
  74. # so you can use a proxy layer to handle it(e.g. slb, nginx)
  75. apiVersion: v1
  76. kind: Service
  77. metadata:
  78. name: gitea-ssh
  79. namespace: gitea
  80. labels:
  81. app: gitea-ssh
  82. spec:
  83. ports:
  84. - port: 22
  85. targetPort: 22
  86. nodePort: 30022
  87. name: ssh
  88. selector:
  89. app: gitea
  90. type: NodePort
  91. ---
  92. # Ingress is always suitable for HTTP usage,
  93. # we suggest using an proxy layer such as slb to send traffic to different ports.
  94. # Usually 80/443 for web and 22 directly for SSH.
  95. apiVersion: extensions/v1beta1
  96. kind: Ingress
  97. metadata:
  98. name: gitea
  99. namespace: gitea
  100. spec:
  101. rules:
  102. - host: your-gitea-host.com
  103. http:
  104. paths:
  105. - backend:
  106. serviceName: gitea-web
  107. servicePort: 80
上海开阖软件有限公司 沪ICP备12045867号-1