# Pgsql HA on kubernetes

**URL:** <https://forum.ansible.com/t/pgsql-ha-on-kubernetes/33747>\
**Category:** AWX Project\
**Tags:** awx-project, awx, kubernetes\
**Created:** [September 5, 2020, 2:27am UTC](https://forum.ansible.com/t/pgsql-ha-on-kubernetes/33747 "2020-09-05T02:27:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sajin\_A](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@Sajin\_A](https://forum.ansible.com/u/Sajin_A)\
**Post date:** [September 5, 2020, 2:27am UTC](https://forum.ansible.com/t/pgsql-ha-on-kubernetes/33747/1 "2020-09-05T02:27:57Z")

</div>

Hi,  
I am deploying awx project on the k8s platform with pgsql master and slave. I am facing issues on HA part, When i stopped the Master pgsql pod, the awx stopped working.

Here is my pgsql value file

postgresqlUsername: {{ pg\_username }}  
postgresqlPassword: {{ pg\_password }}  
postgresqlDatabase: {{ pg\_database }}  
persistence:  
size: {{ pg\_volume\_capacity|default(‘5’) }}Gi  
{% if pg\_persistence\_storageClass is defined %}  
storageClass: {{ pg\_persistence\_storageClass }}  
{% endif %}  
{% if pg\_cpu\_limit is defined or pg\_mem\_limit is defined %}  
resources:  
limits:  
{% if pg\_cpu\_limit is defined %}  
cpu: {{ pg\_cpu\_limit | string }}m  
{% endif %}  
{% if pg\_mem\_limit is defined %}  
memory: {{ pg\_mem\_limit | string }}Gi  
{% endif %}  
{% endif %}  
{% if tolerations is defined or node\_selector is defined or affinity is defined %}  
master:  
{% if tolerations is defined %}  
tolerations:  
{{ tolerations | to\_nice\_yaml(indent=2) | indent(width=4, indentfirst=True) }}  
{% endif %}  
{% if node\_selector is defined %}  
nodeSelector:  
{{ node\_selector | to\_nice\_yaml(indent=2) | indent(width=4, indentfirst=True) }}  
{% endif %}  
{% if affinity is defined %}  
affinity:  
{{ affinity | to\_nice\_yaml(indent=2) | indent(width=4, indentfirst=True) }}  
{% endif %}  
{% endif %}  
{% if pg\_image\_registry is defined %}  
image:  
registry: {{ pg\_image\_registry }}  
volumePermissions:  
image:  
registry: {{ pg\_image\_registry }}  
metrics:  
image:  
registry: {{ pg\_image\_registry }}  
{% endif %}  
{% if pg\_serviceaccount is defined %}  
serviceAccount:  
enabled: true  
name: {{ pg\_serviceaccount }}  
{% endif %}  
replication:  
enabled: true  
user: repluser  
password: replpassword  
slaveReplicas: 2

## Set synchronous commit mode: on, off, remote\_apply, remote\_write and local

## ref: [https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL](https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL)

synchronousCommit: “on”

## \>From the number of `slaveReplicas` defined above, set the number of those that will have synchronous replication

## NOTE: It cannot be \> slaveReplicas

numSynchronousReplicas: 1

## Replication Cluster application name. Useful for defining multiple replication policies

applicationName: awx

Here is my inventory file

[root@host installer]# grep -v “^#” inventory  
localhost ansible\_connection=local ansible\_python\_interpreter=“/usr/bin/env python3”  
[all:vars]  
dockerhub\_base=ansible  
kubernetes\_context=kubeawx  
kubernetes\_namespace=prodawx  
pg\_volume\_capacity=20  
pg\_persistence\_storageClass=storagepool  
kubernetes\_ingress\_hostname=[prodawx.mydomain.com](http://prodawx.mydomain.com)  
kubernetes\_ingress\_annotations={‘[kubernetes.io/ingress.class](http://kubernetes.io/ingress.class)’: ‘nginx’}  
kubernetes\_ingress\_tls\_secret=awx-tls  
awx\_task\_hostname=awx  
awx\_web\_hostname=awxweb  
postgres\_data\_dir=“~/.awx/pgdocker”  
host\_port=80  
host\_port\_ssl=443  
docker\_compose\_dir=“~/.awx/awxcompose”  
pg\_username=awx  
pg\_password=\*\*\*\*\*\*  
pg\_database=awx  
pg\_port=5432  
admin\_user=admin  
admin\_password=\*\*\*\*\*\*  
create\_preload\_data=True  
secret\_key=\*\*\*\*\*\*

Could you someone help me what would be cause of this issue.

Thanks,  
Sajin.
