- Aula 08: nginx-ingress TCP passthrough gitlab→gitea, comments
- Aula 09: add-client.sh API GitLab→Gitea
- Aula 11: node-bugado deployment image registry.kube.quest→gitea.kube.quest
- Aula 12: setup.sh/cleanup.sh API GitLab→Gitea, ArgoCD repoURL
- Aula 13: k8s manifests, benchmarks: registry.kube.quest→gitea.kube.quest,
gitlab-registry→gitea-registry, GITLAB_TOKEN→GITEA_TOKEN
- Aula 14: comments GitLab→Gitea
- README raiz: arquitetura, tabela, DNS
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
# =============================================================================
|
|
# Deployment - PostgreSQL (Container Factory)
|
|
# =============================================================================
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: postgresql
|
|
labels:
|
|
app: postgresql
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/component: database
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate # PostgreSQL não suporta rolling update
|
|
selector:
|
|
matchLabels:
|
|
app: postgresql
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgresql
|
|
spec:
|
|
terminationGracePeriodSeconds: 30
|
|
imagePullSecrets:
|
|
- name: gitea-registry
|
|
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 70 # postgres user no Alpine
|
|
fsGroup: 70
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
|
|
containers:
|
|
- name: postgresql
|
|
# Imagem da Container Factory (eStargz)
|
|
image: gitea.kube.quest/factory/postgresql:17
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
ports:
|
|
- containerPort: 5432
|
|
name: postgresql
|
|
protocol: TCP
|
|
|
|
env:
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgresql-secret
|
|
key: username
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgresql-secret
|
|
key: password
|
|
- name: POSTGRES_DB
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: postgresql-config
|
|
key: database
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
|
|
# Liveness: reinicia se PostgreSQL travar
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 6
|
|
|
|
# Readiness: remove do service se não estiver pronto
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: postgresql-data
|