gogs-deployment.yaml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: gogs
  5. namespace: nginx-app
  6. labels:
  7. app: gogs
  8. spec:
  9. replicas: 1
  10. selector:
  11. matchLabels:
  12. app: gogs
  13. template:
  14. metadata:
  15. labels:
  16. app: gogs
  17. spec:
  18. containers:
  19. - name: gogs
  20. image: registry.cn-hangzhou.aliyuncs.com/zhongpengqun/wanderer:linux-amd64-gogs-0.13
  21. ports:
  22. - containerPort: 3000
  23. - containerPort: 22
  24. env:
  25. # 关键1:HTTP_HOST=0.0.0.0 监听全网卡
  26. - name: GOGS__server__HTTP_HOST
  27. value: "0.0.0.0"
  28. # 关键2:ROOT_URL换成你的域名,后续gogs内部跳转正常
  29. - name: GOGS__server__ROOT_URL
  30. value: "http://gogs2.9981.tech"
  31. - name: GOGS__database__DB_TYPE
  32. value: "sqlite3"
  33. - name: GOGS__database__PATH
  34. value: "/data/gogs.db"
  35. volumeMounts:
  36. - name: gogs-data
  37. mountPath: /data
  38. resources:
  39. requests:
  40. memory: "256Mi"
  41. cpu: "250m"
  42. limits:
  43. memory: "512Mi"
  44. cpu: "1000m"
  45. volumes:
  46. - name: gogs-data
  47. persistentVolumeClaim:
  48. claimName: gogs-pvc
  49. ---
  50. apiVersion: v1
  51. kind: Service
  52. metadata:
  53. name: gogs-service
  54. namespace: nginx-app
  55. labels:
  56. app: gogs
  57. spec:
  58. selector:
  59. app: gogs
  60. ports:
  61. - name: http
  62. port: 3000
  63. targetPort: 3000
  64. - name: ssh
  65. port: 22
  66. targetPort: 22
  67. type: ClusterIP
  68. ---
  69. apiVersion: v1
  70. kind: PersistentVolumeClaim
  71. metadata:
  72. name: gogs-pvc
  73. namespace: nginx-app
  74. spec:
  75. accessModes:
  76. - ReadWriteOnce
  77. resources:
  78. requests:
  79. storage: 5Gi