Skip to content

Gitea installation on k3s

Gitea is a painless self-hosted Git service. It is similar to GitHub, Bitbucket, and GitLab.

Project page: https://gitea.io

Requirements

  • k3s cluster
  • kubectl
  • helm
  • Longhorn installed on cluster

Installation

kubectl create namespace git

Install postgres

kubectl apply -f postgres
  • The password for the postgres user is specified by the POSTGRESS_PASSWORD environment variable, which uses a secret (postgres/secret.yaml)
  • The data volume uses a PersistentVolumeClaim backed by Longhorn, so that it doesn't get deleted when the pod is restarted (postgres/statefulset.yaml)
  • Database is created by using initialization scripts in a ConfigMap. (postgres/configmap.yaml)
  • The postgres instance needs to be exposed to the Gitea instance; use a ClusterIP service for that (postgres/service.yaml)

Install Gitea using Helm

Gitea Helm Chart

helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
helm install gitea gitea-charts/gitea --namespace git --values values.yaml

Expose Gitea installation

The DNS record pointing to cluster IP should be created, the host should be set to ingress.yaml (spec.rules.host)

Expose http UI using Ingress service:

kubectl apply -f ingress.yaml