gogs-statefulset.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. labels:
  5. app: gogs-app
  6. name: gogs-app
  7. namespace: gogs
  8. spec:
  9. replicas: 1
  10. selector:
  11. matchLabels:
  12. app: gogs-app
  13. serviceName: gogs-app
  14. template:
  15. metadata:
  16. labels:
  17. app: gogs-app
  18. spec:
  19. securityContext:
  20. fsGroup: 1000 # <--- Esto solucionará el fallo de "permission denied"
  21. initContainers:
  22. - name: fix-logs
  23. image: gogs/gogs
  24. imagePullPolicy: IfNotPresent
  25. command: ["sh", "-c", "mkdir -p /app/gogs/log && chown -R 1000:1000 /app/gogs/log"]
  26. securityContext:
  27. runAsUser: 0
  28. volumeMounts:
  29. - name: gogs-pv
  30. mountPath: /data
  31. containers:
  32. - image: gogs/gogs
  33. imagePullPolicy: IfNotPresent
  34. name: gogs-app
  35. resources: {}
  36. ports:
  37. - containerPort: 3000
  38. name: web
  39. protocol: TCP
  40. - containerPort: 22
  41. name: ssh
  42. protocol: TCP
  43. volumeMounts:
  44. - name: gogs-pv
  45. mountPath: /data
  46. imagePullSecrets:
  47. - name: reg-cred-secret
  48. dnsPolicy: ClusterFirst
  49. restartPolicy: Always
  50. terminationGracePeriodSeconds: 30
  51. volumeClaimTemplates:
  52. - metadata:
  53. name: gogs-pv
  54. spec:
  55. accessModes: [ "ReadWriteOnce" ]
  56. resources:
  57. requests:
  58. storage: 10Gi