Files
HomeLabScripts/k3s/apps/gitea/gitea.yaml
2025-05-02 19:07:42 +02:00

186 lines
3.5 KiB
YAML

# Namespace
---
apiVersion: v1
kind: Namespace
metadata:
name: gitea
# PV + PVC: Gitea (NFS)
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: gitea-pv
spec:
storageClassName: nfs
capacity:
storage: 30Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.178.132
path: /slowData/gitea/repos
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-pvc
namespace: gitea
spec:
storageClassName: nfs
accessModes:
- ReadWriteMany
resources:
requests:
storage: 30Gi
# PV + PVC: PostgreSQL (NFS)
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-pv
spec:
storageClassName: nfs
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.178.132
path: /slowData/gitea/postgres
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
namespace: gitea
spec:
storageClassName: nfs
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
# Deployment: PostgreSQL
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: gitea
spec:
replicas: 1
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
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
# 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:
containers:
- name: gitea
image: gitea/gitea:latest
env:
- name: USER_UID
value: "1000"
- name: USER_GID
value: "1000"
- 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
ports:
- containerPort: 3000 # HTTP
- containerPort: 22 # SSH
volumeMounts:
- name: gitea-storage
mountPath: /data
volumes:
- name: gitea-storage
persistentVolumeClaim:
claimName: gitea-pvc
# 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: 22
targetPort: 22