# Namespace --- apiVersion: v1 kind: Namespace metadata: name: gitea # PVC: PostgreSQL (Longhorn target) --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: postgres-longhorn-pvc-3g namespace: gitea spec: storageClassName: longhorn accessModes: - ReadWriteOnce resources: requests: storage: 3Gi # Deployment: PostgreSQL --- apiVersion: apps/v1 kind: Deployment metadata: name: postgres namespace: gitea spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - name: postgres image: postgres:13 env: - name: POSTGRES_DB value: gitea - name: POSTGRES_USER value: gitea - name: POSTGRES_PASSWORD value: giteapassword ports: - containerPort: 5432 volumeMounts: - name: postgres-storage mountPath: /var/lib/postgresql/data securityContext: fsGroup: 999 volumes: - name: postgres-storage persistentVolumeClaim: claimName: postgres-longhorn-pvc-3g # Service: PostgreSQL --- apiVersion: v1 kind: Service metadata: name: postgres namespace: gitea spec: selector: app: postgres ports: - protocol: TCP port: 5432 targetPort: 5432 # Deployment: Gitea --- apiVersion: apps/v1 kind: Deployment metadata: name: gitea namespace: gitea spec: replicas: 1 selector: matchLabels: app: gitea template: metadata: labels: app: gitea spec: nodeSelector: kubernetes.io/hostname: knode1 containers: - name: gitea image: gitea/gitea:latest env: - name: USER_UID value: "1024" - name: USER_GID value: "100" - name: GITEA__database__DB_TYPE value: postgres - name: GITEA__database__HOST value: postgres:5432 - name: GITEA__database__NAME value: gitea - name: GITEA__database__USER value: gitea - name: GITEA__database__PASSWD value: giteapassword - name: GITEA__server__ROOT_URL value: "https://git.henryathome.home64.de" - name: GITEA__server__DOMAIN value: git.henryathome.home64.de - name: GITEA__server__PROTOCOL value: http - name: GITEA__server__SSH_DOMAIN value: git.henryathome.home64.de - name: GITEA__server__START_SSH_SERVER value: "true" - name: GITEA__server__SSH_LISTEN_PORT value: "32000" - name: GITEA__server__SSH_PORT value: "32000" - name: GITEA__packages__ENABLED value: "true" - name: GITEA__repository__ROOT value: /data/gitea/git/repositories - name: GITEA__lfs__PATH value: /data/gitea/git/lfs ports: - containerPort: 3000 # HTTP - containerPort: 32000 # SSH volumeMounts: - name: gitea-storage mountPath: /data volumes: - name: gitea-storage persistentVolumeClaim: claimName: gitea-pvc-target # Service: Gitea (inkl. SSH) --- apiVersion: v1 kind: Service metadata: name: gitea namespace: gitea spec: selector: app: gitea type: NodePort # Alternativ: LoadBalancer für Clouds ports: - name: http protocol: TCP port: 80 targetPort: 3000 - name: ssh protocol: TCP port: 32000 targetPort: 32000 nodePort: 32000