kubernetes deployment strategy notes

This commit is contained in:
Super User
2026-10-30 17:18:18 -07:00
parent 504f81de76
commit 35c9d9fd36
57 changed files with 1677 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
no AI used here. Pretty much just a copy+paste of my Gitea deployment on Openshift. Worth noting - I actually started out with a helm chart deployment, but ran into issues with pods not spinning up, so I went back to basics and did it fully manually and worked perfectly.
+19
View File
@@ -0,0 +1,19 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
annotations:
name: letsencrypt
namespace: gitea
spec:
commonName: 'gitea.k8s.lab.cudanet.org'
dnsNames:
- 'gitea.k8s.lab.cudanet.org'
duration: 2160h0m0s
issuerRef:
kind: ClusterIssuer
name: letsencrypt
renewBefore: 360h0m0s
secretName: letsencrypt
usages:
- server auth
- client auth
+70
View File
@@ -0,0 +1,70 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
app: gitea
app.kubernetes.io/component: gitea
app.kubernetes.io/instance: gitea
name: gitea
namespace: gitea
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
deployment: gitea
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
creationTimestamp: null
labels:
deployment: gitea
spec:
containers:
- env:
- name: GITEA__database__DB_TYPE
value: mysql
- name: GITEA__database__HOST
value: mariadb
- name: GITEA__database__NAME
value: gitea
- name: GITEA__database__USER
value: gitea
- name: GITEA__database__PASSWD
value: gitea
image: docker.gitea.com/gitea@sha256:3a54ec4b271f0479eb1f40624cbf90f2245306aab8533dd14bb5f49f4c580ccf
imagePullPolicy: IfNotPresent
name: gitea
ports:
- containerPort: 2222
protocol: TCP
- containerPort: 3000
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/gitea
name: gitea-config
- mountPath: /var/lib/gitea
name: gitea-data
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: gitea-config
persistentVolumeClaim:
claimName: gitea-config
- name: gitea-data
persistentVolumeClaim:
claimName: gitea-data
+33
View File
@@ -0,0 +1,33 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
name: gitea-config
namespace: gitea
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: nfs
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
finalizers:
- kubernetes.io/pvc-protection
name: gitea-data
namespace: gitea
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: nfs
volumeMode: Filesystem
---
+28
View File
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: gitea
app.kubernetes.io/component: gitea
app.kubernetes.io/instance: gitea
name: gitea
namespace: gitea
spec:
clusterIP:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: web
port: 3000
protocol: TCP
targetPort: 3000
- name: ssh
port: 2222
protocol: TCP
targetPort: 2222
selector:
deployment: gitea
sessionAffinity: None
type: ClusterIP
+24
View File
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gitea-ingress
namespace: gitea
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
spec:
ingressClassName: traefik
tls:
- hosts:
- gitea.k8s.lab.cudanet.org
secretName: letsencrypt
rules:
- host: gitea.k8s.lab.cudanet.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gitea
port:
number: 3000
+14
View File
@@ -0,0 +1,14 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: gitea-web
namespace: gitea
spec:
entryPoints:
- websecure
routes:
- match: Host(`gitea.k8s.lab.cudanet.org`)
kind: Rule
services:
- name: gitea
port: 3000
+60
View File
@@ -0,0 +1,60 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
app: mariadb
app.kubernetes.io/component: mariadb
app.kubernetes.io/instance: mariadb
name: mariadb
namespace: gitea
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
deployment: mariadb
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
labels:
deployment: mariadb
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: gitea
- name: MYSQL_USER
value: gitea
- name: MYSQL_PASSWORD
value: gitea
- name: MYSQL_DATABASE
value: gitea
image: docker.io/library/mariadb@sha256:659a15e38f4ccb2bfa2c7cf824a8a5955fdc5f63cfd01537bc25c9e0ff716605
imagePullPolicy: IfNotPresent
name: mariadb
ports:
- containerPort: 3306
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/mysql
name: mariadb
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: mariadb
persistentVolumeClaim:
claimName: mariadb
+15
View File
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
name: mariadb
namespace: gitea
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: nfs
volumeMode: Filesystem
+26
View File
@@ -0,0 +1,26 @@
---
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
app: mariadb
app.kubernetes.io/component: mariadb
app.kubernetes.io/instance: mariadb
name: mariadb
namespace: gitea
spec:
clusterIP:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: 3306-tcp
port: 3306
protocol: TCP
targetPort: 3306
selector:
deployment: mariadb
sessionAffinity: None
type: ClusterIP
+8
View File
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
labels:
kubernetes.io/metadata.name: gitea
name: gitea