58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: postgresql
|
|
spec:
|
|
replicas: 1
|
|
serviceName: postgresql
|
|
selector:
|
|
matchLabels:
|
|
app: postgresql
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgresql
|
|
spec:
|
|
containers:
|
|
- name: postgresql
|
|
image: postgres:14
|
|
ports:
|
|
- containerPort: 5432
|
|
volumeMounts:
|
|
- name: postgresql-data
|
|
mountPath: /var/lib/postgresql/data
|
|
env:
|
|
- name: POSTGRES_USER
|
|
value: "sonar"
|
|
- name: POSTGRES_PASSWORD
|
|
value: "sonar"
|
|
- name: POSTGRES_DB
|
|
value: "sonar"
|
|
volumes:
|
|
- name: postgresql-data
|
|
hostPath:
|
|
path: /data/sonarqube/postgresql/data
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: "kubernetes.io/hostname"
|
|
operator: In
|
|
values:
|
|
- bfs-k8snode-10-2-0-16.hetzner.base.beaconfireinc.com
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgresql
|
|
labels:
|
|
app: postgresql
|
|
spec:
|
|
ports:
|
|
- protocol: TCP
|
|
port: 5432
|
|
targetPort: 5432
|
|
selector:
|
|
app: postgresql
|
|
type: ClusterIP |