gogs-nodeport-deployment.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: gogs-config
  5. namespace: nginx-app
  6. data:
  7. app.ini: |
  8. [server]
  9. HTTP_ADDR = 0.0.0.0
  10. HTTP_PORT = 3000
  11. ROOT_URL = http://gogs2.9981.tech/
  12. DOMAIN = gogs2.9981.tech
  13. [database]
  14. DB_TYPE = sqlite3
  15. PATH = /data/gogs.db
  16. [repository]
  17. ROOT = /data/git/gogs-repo
  18. ---
  19. apiVersion: apps/v1
  20. kind: Deployment
  21. metadata:
  22. name: gogs
  23. namespace: nginx-app
  24. labels:
  25. app: gogs
  26. spec:
  27. replicas: 1
  28. selector:
  29. matchLabels:
  30. app: gogs
  31. template:
  32. metadata:
  33. labels:
  34. app: gogs
  35. spec:
  36. containers:
  37. - name: gogs
  38. image: registry.cn-hangzhou.aliyuncs.com/zhongpengqun/wanderer:linux-amd64-gogs-0.13
  39. command: ["/app/gogs/gogs"]
  40. args: ["web", "--config", "/data/gogs/conf/app.ini"]
  41. ports:
  42. - containerPort: 3000
  43. env:
  44. - name: GOGS_SERVER_HTTP_ADDR
  45. value: "0.0.0.0"
  46. volumeMounts:
  47. - name: gogs-data
  48. mountPath: /data
  49. - name: gogs-config
  50. mountPath: /data/gogs/conf/app.ini
  51. subPath: app.ini
  52. volumes:
  53. - name: gogs-data
  54. persistentVolumeClaim:
  55. claimName: gogs-pvc
  56. - name: gogs-config
  57. configMap:
  58. name: gogs-config
  59. ---
  60. apiVersion: v1
  61. kind: Service
  62. metadata:
  63. name: gogs-service
  64. namespace: nginx-app
  65. spec:
  66. type: NodePort # <--- 改成这个
  67. selector:
  68. app: gogs
  69. ports:
  70. - name: http
  71. port: 3000
  72. targetPort: 3000
  73. nodePort: 30300 # <--- 固定端口