Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cordoval
Forked from kadel/test.sh
Created May 20, 2017 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cordoval/13c3962a3155bf26147d137d264df41a to your computer and use it in GitHub Desktop.
Save cordoval/13c3962a3155bf26147d137d264df41a to your computer and use it in GitHub Desktop.
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/
#
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