k8s/manifests/02-deployments/deployment-pgadmin.yaml

89 lines
1.9 KiB
YAML
Raw Normal View History

2023-12-14 20:20:16 +10:00
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgadmin
namespace: pg
spec:
selector:
matchLabels:
app: pgadmin
replicas: 1
template:
metadata:
labels:
app: pgadmin
spec:
2023-12-14 20:34:31 +10:00
initContainers:
2023-12-14 20:35:15 +10:00
# костыль взят отсюда https://devpress.csdn.net/k8s/62fd568b7e66823466191f32.html
2023-12-14 20:34:31 +10:00
- name: pgadmin-data-permission-fix
image: busybox
command: ["/bin/chown", "-R", "5050:5050", "/var/lib/pgadmin"]
volumeMounts:
- name: pgadmin
mountPath: /var/lib/pgadmin
2023-12-14 20:20:16 +10:00
containers:
2023-12-14 20:30:25 +10:00
- name: pgadmin4
image: dpage/pgadmin4
env:
- name: PGADMIN_DEFAULT_EMAIL
value: "admin@guaranteedstruggle.host"
- name: PGADMIN_DEFAULT_PASSWORD
valueFrom:
secretKeyRef:
name: pgadmin-secret
key: pgadmin-default-password
- name: PGADMIN_PORT
value: "80"
ports:
- containerPort: 80
name: pgadminport
volumeMounts:
- mountPath: /var/lib/pgadmin
2023-12-14 20:50:06 +10:00
name: pgadmin
- name: pgadmin-config
mountPath: /pgadmin4/servers.json
subPath: servers.json
readOnly: true
2023-12-14 20:30:25 +10:00
volumes:
2023-12-14 20:52:03 +10:00
- name: pgadmin
persistentVolumeClaim:
claimName: pgadmin-pv-claim
- name: pgadmin-config
configMap:
name: pgadmin-config
2023-12-14 20:30:25 +10:00
---
kind: PersistentVolume
apiVersion: v1
metadata:
namespace: pg
name: pgadmin-pv-volume
labels:
type: local
app: pgadmin
spec:
storageClassName: longhorn
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
namespace: pg
name: pgadmin-pv-claim
labels:
app: pgadmin
spec:
storageClassName: longhorn
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi