Skip to content

Commit

Permalink
postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogesh authored and Yogesh committed Sep 21, 2019
0 parents commit d5ba9a2
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: qa
labels:
service: postgres
env: qa
spec:
clusterIP: None
ports:
- name: postgres
port: 5432
targetPort: postgres
publishNotReadyAddresses: true
selector:
service: postgres
env: qa
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: postgres-ui
namespace: qa
annotations:
cloud.google.com/load-balancer-type: "Internal"
labels:
service: postgres
env: qa
spec:
externalTrafficPolicy: Cluster
ports:
- name: postgres
nodePort: 30222
port: 5432
targetPort: postgres
selector:
service: postgres
env: qa
type: LoadBalancer
loadBalancerIP: "10.151.0.17"
loadBalancerSourceRanges:
- 10.0.0.0/8
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: qa
labels:
service: postgres
spec:
serviceName: postgres
replicas: 1
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
service: postgres
env: qa
template:
metadata:
labels:
service: postgres
env: qa
spec:
terminationGracePeriodSeconds: 500
containers:
- name: postgres
image: postgres:10.8
imagePullPolicy: Always
securityContext:
privileged: false
ports:
- name: postgres
containerPort: 5432
env:
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PASSWORD
livenessProbe:
failureThreshold: 10
initialDelaySeconds: 1000
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 10
exec:
command:
- sh
- -c
- exec pg_isready --host $POD_IP
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 500
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 10
exec:
command:
- sh
- -c
- exec pg_isready --host $POD_IP
resources:
requests:
memory: "15G"
cpu: "4"
limits:
memory: "30G"
cpu: "8"
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/postgresql/data
volumes:
- name: postgresql-data
hostpath:
path: /tmp
type: Directory

0 comments on commit d5ba9a2

Please sign in to comment.