GITEA (Self-Hosted Git Platform)
This blog describes the Gitea deployment on Kubernetes.
Gitea is a self-hosted, open-source git service that provides a lightweight,easy-to-use platform for managing git repositories.
With this idea, we can be the owner of our git service.
Gitea supports various databases like mysqlite, PostgreSQL, and mysqlite3. It has an inbuilt database which is mysqlite3.
You can use an external database of your choice as well by configuring some Environment parameters.
Key features of Gitea:
1)User-friendly-interface
2)Lightweight and fast
3)Self-Hosted solution
4)Repository management
Steps for the deployment of Gitea on a Kubernetes Cluster.
Step:1
-> Create a Statefulset as below. Here we are adding the PersistentVolume.So that even if the pod is deleted the data will remain the same.
-> Depending on the storage you can change the replica count. if you use a storage that supports RWM then you can increase the replica count.
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: gitea
name: gitea
spec:
replicas: 1
selector:
matchLabels:
app: gitea
serviceName: gitea
template:
metadata:
labels:
app: gitea
spec:
containers:
- image: gitea/gitea:latest
name: gitea
volumeMounts:
- mountPath: "/data"
name: gitea-pvc
ports:
- containerPort: 3000
volumeClaimTemplates: # Add the volumeClaimTemplates section
- metadata:
name: gitea-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Step:2
Create a service. yaml to expose the service as Nodeport.
Service. yaml
apiVersion: v1
kind: Service
metadata:
name: gitea
labels:
app: gitea
spec:
ports:
- port: 3000
name: web
clusterIP:
type: NodePort
selector:
app: gitea
The deployment is done..!!! You can access the GUI and register yourself and create your repositories.
\=> If you want to use some external database of your choice then you need to configure the below parameters in the stateful set.yaml
env:
- name: DB_HOST
value: 'postgresql:port'
- name: SKIP_TLS_VERIFICATION
value: 'true'
- name: GITEA_SERVICE_DB_URL
value: 'postgresql:port/gitea'
- name: DB_USER
value: 'gitea'
- name: DB_PORT
value: 'port'
- name: DB_TYPE
value: 'postgres'
Subscribe to my newsletter
Read articles from Sharath Veerapaneni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sharath Veerapaneni
Sharath Veerapaneni
I am a DevOps Engineer