gitea
Gitea Helm chart for Kubernetes
About this chart
Gitea Helm Chart
- Introduction
- Update and versioning policy
- Dependencies
- HA Dependencies
- Non-HA Dependencies
- Dependency Versioning
- Installing
- High Availability
- Limit resources
- Configuration
- Default Configuration
- Database defaults
- Server defaults
- Metrics defaults
- Rootless Defaults
- Session, Cache and Queue
- Single-Pod Configurations
- Additional app.ini settings
- User defined environment variables in app.ini
- External Database
- Ports and external url
- ClusterIP
- SSH and Ingress
- SSH on crio based kubernetes cluster
- Cache
- Persistence
- Admin User
- LDAP Settings
- OAuth2 Settings
- Default Configuration
- Configure commit signing
- Metrics and profiling
- Secure Metrics Endpoint
- Pod annotations
- TLS certificate rotation
- Themes
- Renovate
- Parameters
- Global
- strategy
- Image
- Security
- Service
- Ingress
- Route
- Gateway API
- deployment
- ServiceAccount
- Persistence
- Init
- Signing
- Gitea
- LivenessProbe
- ReadinessProbe
- StartupProbe
- valkey-cluster
- valkey
- PostgreSQL HA
- PostgreSQL
- Advanced
- Contributing
- Upgrading
Gitea is a community managed lightweight code hosting solution written in Go. It is published under the MIT license.
Introduction
This helm chart has taken some inspiration from jfelten's helm chart. Yet it takes a completely different approach in providing a database and cache with dependencies. Additionally, this chart allows to provide LDAP and admin user configuration with values.
Update and versioning policy
The Gitea helm chart versioning does not follow Gitea's versioning. The latest chart version can be looked up in https://dl.gitea.com/charts or in the repository releases.
The chart aims to follow Gitea's releases closely.
There might be times when the chart is behind the latest Gitea release.
This might be caused by different reasons, most often due to time constraints of the maintainers (remember, all work here is done voluntarily in the spare time of people).
If you're eager to use the latest Gitea version earlier than this chart catches up, then change the tag in values.yaml to the latest Gitea version.
Note that besides the exact Gitea version one can also use the :1 tag to automatically follow the latest Gitea version.
This should be combined with image.pullPolicy: "Always".
Important: Using the :1 will also automatically jump to new minor release (e.g. from 1.13 to 1.14) which may eventually cause incompatibilities if major/breaking changes happened between these versions.
This is due to Gitea not strictly following semantic versioning as breaking changes do not increase the major version.
I.e., "minor" version bumps are considered "major".
Yet most often no issues will be encountered and the chart maintainers aim to communicate early/upfront if this would be the case.
Dependencies
Gitea is most performant when run with an external database and cache. This chart provides those dependencies via sub-charts. Users can also configure their own external providers via the configuration.
HA Dependencies
These dependencies are enabled by default:
- PostgreSQL HA (Bitnami PostgreSQL-HA)
- Valkey-Cluster (Bitnami Valkey-Cluster)
Non-HA Dependencies
Alternatively, the following non-HA replacements are available:
- PostgreSQL (Bitnami PostgreSQL)
- Valkey (Bitnami Valkey)
Dependency Versioning
Updates of sub-charts will be incorporated into the Gitea chart as they are released. The reasoning behind this is that new users of the chart will start with the most recent sub-chart dependency versions.
Note If you want to stay on an older appVersion of a sub-chart dependency (e.g. PostgreSQL), you need to override the image tag in your values.yaml file.
In fact, we recommend to do so right from the start to be independent of major sub-chart dependency changes as they are released.
There is no need to update to every new PostgreSQL major version - you can happily skip some and do larger updates when you are ready for them.
We recommend to use a rolling tag like :<majorVersion>-debian-<debian major version> to incorporate minor and patch updates for the respective major version as they are released.
Alternatively you can also use a versioning helper tool like renovate.
Please double-check the image repository and available tags in the sub-chart:
and look up the image tag which fits your needs on Dockerhub.
Installing
helm repo add gitea-charts https://dl.gitea.com/charts/
helm repo update
helm install gitea gitea-charts/gitea
Alternatively, the chart can also be installed from Dockerhub (since v9.6.0)
helm install gitea oci://registry-1.docker.io/giteacharts/gitea
To avoid potential Dockerhub rate limits, the chart can also be installed via docker.gitea.com (since v9.6.0)
helm install gitea oci://docker.gitea.com/charts/gitea
When upgrading, please refer to the Upgrading section at the bottom of this document for major and breaking changes.
High Availability
Since version 9.0.0 this chart supports running Gitea and it's dependencies in HA mode. Care must be taken for production use as not all implementation details of Gitea core are officially HA-ready yet.
Deploying a HA-ready Gitea instance requires some effort including using HA-ready dependencies. See the HA Setup document for more details.
Limit resources
If the application is deployed with a CPU resource limit, Prometheus may throw a CPU throttling warning for the application. This has more or less to do with the fact that the application finds the number of CPUs of the host, but cannot use the available CPU time to perform computing operations.
The application must be informed that despite several CPUs only a part (limit) of the available computing time is
available. As this is a Golang application, this can be implemented using GOMAXPROCS. The following example is one way
of defining GOMAXPROCS automatically based on the defined CPU limit like 1000m. Please keep in mind, that the CFS
rate of 100ms - default on each kubernetes node, is also very important to avoid CPU throttling.
Further information about this topic can be found under this link.
[!NOTE] The environment variable
GOMAXPROCSis set automatically, when a CPU limit is defined. An explicit configuration is not anymore required.Please note that a CPU limit <
1000mcan also lead to CPU throttling. Please read the linked documentation carefully.
deployment:
env:
# Will be automatically defined!
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
divisor: "1" # Is required for GitDevOps systems like ArgoCD/Flux. Otherwise throw the system a diff error. (k8s-default=1)
resource: limits.cpu
resources:
limits:
cpu: 1000m
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Configuration
Gitea offers lots of configuration options. This is fully described in the Gitea Cheat Sheet.
gitea:
config:
APP_NAME: "Gitea: With a cup of tea."
repository:
ROOT: "~/gitea-repositories"
repository.pull-request:
WORK_IN_PROGRESS_PREFIXES: "WIP:,[WIP]:"
Default Configuration
This chart will set a few defaults in the Gitea configuration based on the service and ingress settings.
All defaults can be overwritten in gitea.config.
INSTALL_LOCK is always set to true, since we want to configure Gitea with this helm chart and everything is taken care of.
All default settings are made directly in the generated app.ini, not in the Values.
Database defaults
If a builtIn database is enabled the database configuration is set automatically.
For example, PostgreSQL builtIn will appear in the app.ini as:
[database]
DB_TYPE = postgres
HOST = RELEASE-NAME-postgresql.default.svc.cluster.local:5432
NAME = gitea
PASSWD = gitea
USER = gitea
Server defaults
The server defaults are a bit more complex.
If ingress is enabled, the ROOT_URL, DOMAIN and SSH_DOMAIN will be set accordingly.
HTTP_PORT always defaults to 3000 as well as SSH_PORT to 22.
[server]
APP_DATA_PATH = /data
DOMAIN = git.example.com
HTTP_PORT = 3000
PROTOCOL = http
ROOT_URL = http://git.example.com
SSH_DOMAIN = git.example.com
SSH_LISTEN_PORT = 22
SSH_PORT = 22
ENABLE_PPROF = false
Metrics defaults
The Prometheus /metrics endpoint is disabled by default.
[metrics]
ENABLED = false
Rootless Defaults
If .Values.image.rootless: true, then the following will occur. In case you use .Values.image.fullOverride, check that this works in your image:
-
$HOMEbecomes/data/gitea/gitsee deployment.yaml template inside (init-)container "env" declarations
-
START_SSH_SERVER: true(Unless explicity overwritten bygitea.config.server.START_SSH_SERVER)see _helpers.tpl in
gitea.inline_configuration.defaults.serverdefinition -
SSH_LISTEN_PORT: 2222(Unless explicity overwritten bygitea.config.server.SSH_LISTEN_PORT)see _helpers.tpl in
gitea.inline_configuration.defaults.serverdefinition -
SSH_LOG_LEVELenvironment variable is not injected into the containersee deployment.yaml template inside container "env" declarations
OpenShift Compatibility
When installing on OpenShift, enable the compatibility profile so chart-managed pods render SCC-safe defaults and the Gitea init containers stop forcing runAsUser: 1000:
openshift:
enabled: true
When enabled, the chart applies allowPrivilegeEscalation: false, drops all
Linux capabilities, sets runAsNonRoot: true, uses
seccompProfile.type: RuntimeDefault, and leaves hostUsers unset unless
openshift.hostUsers is explicitly overridden.
The deployment keeps the existing vanilla Kubernetes behavior when OpenShift
compatibility is disabled. Auto-detection relies on the
security.openshift.io/v1/SecurityContextConstraints API, so set
openshift.enabled: true explicitly when rendering outside a live cluster.
If you also want to expose Gitea through an OpenShift Route, enable the optional Route resource:
route:
enabled: true
host: git.apps.example.com
tls:
termination: edge
When route.host is set, the chart uses it for DOMAIN, SSH_DOMAIN, and ROOT_URL. Setting route.tls.termination also switches the default ROOT_URL scheme to https.
Gateway API
The chart can also expose Gitea through Gateway API resources (HTTPRoute, TCPRoute, BackendTLSPolicy, and optionally Gateway).
See docs/gateway-api.md for the full guide, including how routes interact with ROOT_URL/DOMAIN resolution and recommended topologies.
Session, Cache and Queue
The session, cache and queue settings are set to use the built-in Valkey Cluster sub-chart dependency.
If Valkey Cluster is disabled, the chart will fall back to the Gitea defaults which use "memory" for session and cache and "level" for queue.
While these will work and even not cause immediate issues after startup, they are not recommended for production use.
Reasons being that a single pod will take on all the work for session and cache tasks in its available memory.
It is likely that the pod will run out of memory or will face substantial memory spikes, depending on the workload.
External tools such as valkey-cluster or memcached handle these workloads much better.
Single-Pod Configurations
If HA is not needed/desired, the following configurations can be used to deploy a single-p
Deploy gitea with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gitea on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartgitea is pinned at v12.7.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply