-
-
Save cordoval/13c3962a3155bf26147d137d264df41a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl create -f test.yaml | |
#secret "postgres-files-secret" created | |
#statefulset "postgres-statefulset" created | |
kubectl exec -it postgres-statefulset-0 /bin/sh | |
ls -lah /var/lib/postgresql/ | |
# total 12 | |
# drwxr-xr-x 3 root root 4.0K May 19 16:02 . | |
# drwxr-xr-x 3 root root 4.0K May 19 16:02 .. | |
# drwxrwxrwx 2 root root 4.0K May 19 16:02 data | |
ls /var/lib/postgresql/data/ | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: postgres-files-secret | |
type: Opaque | |
data: | |
postgresql.conf: Zm9v | |
pg_hba.conf: Zm9v | |
--- | |
kind: StatefulSet | |
apiVersion: apps/v1beta1 | |
metadata: | |
name: postgres-statefulset | |
spec: | |
serviceName: "postgres" | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: postgres | |
annotations: | |
pod.alpha.kubernetes.io/initialized: "true" | |
spec: | |
imagePullSecrets: | |
- name: regsecret | |
volumes: | |
- | |
name: postgres-files-secret | |
secret: | |
secretName: postgres-files-secret | |
items: | |
- | |
key: postgresql.conf | |
path: "./postgresql.conf" | |
mode: 0777 | |
- | |
key: pg_hba.conf | |
path: "./pg_hba.conf" | |
mode: 0777 | |
- | |
name: postgresdata | |
emptyDir: {} | |
containers: | |
- | |
name: postgres | |
image: tomaskral/sleeper | |
ports: | |
- | |
name: postgres | |
containerPort: 5432 | |
volumeMounts: | |
- | |
name: postgresdata | |
mountPath: /var/lib/postgresql/data | |
- | |
name: postgres-files-secret | |
readOnly: true | |
mountPath: /etc/postgresql/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment