Skip to content

Gitea

deployment.yaml

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: gitea
  name: gitea
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitea
  template:
    metadata:
      labels:
        app: gitea
    spec:
      containers:
      - image: gitea/gitea:1.21.0-rc2
        imagePullPolicy: Always
        name: gitea
        env:
        - name: USER_UID
          value: "1000"
        - name: USER_GID
          value: "1000"
        - name: GITEA__database__DB_TYPE
          value: "postgres"
        - name: GITEA__database__HOST
          value: "postgres-gitea"
        - name: GITEA__database__NAME
          value: "gitea"
        - name: GITEA__database__USER
          value: "gitea"
        - name: GITEA__database__PASSWD
          value: "password"
        ports:
        - containerPort: 3000
          name: gitea
          protocol: TCP
        - containerPort: 22
          name: giteassh
          protocol: TCP
        resources:
          limits:
            cpu: "2"
            memory: 3Gi
          requests:
            cpu: 50m
            memory: 50Mi
        volumeMounts:
        - mountPath: /data
          name: nfs-gitea
      volumes:
      - name: nfs-gitea
        nfs:
          path: /nfs/gitea
          server: 1xx.xx.xx.xx

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: postgres-gitea
  name: postgres-gitea
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres-gitea
  template:
    metadata:
      labels:
        app: postgres-gitea
    spec:
      containers:
      - image: postgres:16.0-alpine
        imagePullPolicy: Always
        name: postgres-gitea
        env:
        - name: POSTGRES_USER
          value: "gitea"
        - name: POSTGRES_PASSWORD
          value: "password"
        - name: POSTGRES_DB
          value: "gitea"
        ports:
        - containerPort: 5432
          protocol: TCP
        resources:
          limits:
            cpu: "2"
            memory: 3Gi
          requests:
            cpu: 50m
            memory: 50Mi
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: nfs-gitea
      volumes:
      - name: nfs-gitea
        nfs:
          path: /nfs/postgres-gitea
          server: 1xx.xx.xx.xx

service.yaml

YAML
apiVersion: v1
kind: Service
metadata:
  labels:
    app: gitea
  name: gitea
  namespace: default
spec:
#   loadBalancerIP: 100.100.100.130
  ports:
  - name: gitea-http
    port: 3000
    protocol: TCP
    targetPort: 3000
  selector:
    app: gitea
#   type: LoadBalancer

---

apiVersion: v1
kind: Service
metadata:
  labels:
    app: gitea
  name: gitea-ssh
  namespace: default
spec:
#   loadBalancerIP: 100.100.100.131
  ports:
  - name: gitea-ssh
    port: 22
    protocol: TCP
    targetPort: 22
  selector:
    app: gitea
#   type: LoadBalancer

---

apiVersion: v1
kind: Service
metadata:
  labels:
    app: postgres-gitea
  name: postgres-gitea
  namespace: default
spec:
  ports:
  - name: postgres-gitea
    port: 5432
    protocol: TCP
    targetPort: 5432
  selector:
    app: postgres-gitea

kustomization.yaml

YAML
resources:
- deployment.yaml
- service.yaml

argocd-app

YAML
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  finalizers:
  - resources-finalizer.argocd.argoproj.io
  name: gitea
  namespace: argocd
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  source:
    chart: gitea
    helm:
      values: |-
        gitea:
          admin:
            username: username
            password: password
            email: "[email protected]"
          ## @param gitea.config  Configuration for the Gitea server,ref: [config-cheat-sheet](https://docs.gitea.io/en-us/config-cheat-sheet/)
          config:
            APP_NAME: "Private Gitea With Full Glass of BEER!!"
            RUN_MODE: prod
            server:
              SSH_PORT: 22
              SSH_DOMAIN: domain-ssh.example.dev
              ROOT_URL: https://domain.example.dev
            service:
              DISABLE_REGISTRATION: false
              REQUIRE_SIGNIN_VIEW: true
              SHOW_REGISTRATION_BUTTON: false
            database:
              DB_TYPE: postgres
              HOST: 192.168.1.56 # portgres.default.svc.cluster.local
              NAME: gitea
              USER: gitea
              PASSWD: password
              SCHEMA: gitea
        ingress:
          enabled: false
          className:
          annotations:
            {}
            # kubernetes.io/ingress.class: nginx
            # kubernetes.io/tls-acme: "true"
          hosts:
            - host: pve-gitea.kafana.dev
        resources:
          limits:
            cpu: 600m
            memory: 1600Mi
          requests:
            cpu: 500m
            memory: 500Mi
        persistence:
          enabled: true
          storageClass: gitea
          existingClaim: vol-gitea
          size: 100Gi
          accessModes:
            - ReadWriteMany
        postgresql:
          enabled: false
        signing:
          enabled: false
          gpgHome: /data/git/.gnupg
    repoURL: https://dl.gitea.com/charts
    targetRevision: 8.3.0
  syncPolicy:
    syncOptions:
    - ServerSideApply=true
    - CreateNamespace=true


# https://gitea.com/gitea/helm-chart/src/tag/v8.3.0/values.yaml

volume.yaml

Bash
apiVersion: v1
kind: PersistentVolume
metadata:
  labels:
    type: local
  name: vol-gitea
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 100Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: vol-gitea
    namespace: default
  hostPath:
    path: /kube-volumes/gitea
    type: ""
  persistentVolumeReclaimPolicy: Retain
  storageClassName: gitea
  volumeMode: Filesystem

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: vol-gitea
  namespace: default
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: gitea
  volumeMode: Filesystem
  volumeName: vol-gitea