Deploying AWX With NFS Share For Postgres Volume

Hello,

I’m needing some guidance on a problem I’m having configuring an NFS share for awx. I am trying to deploy AWX using awx-operator on a microk8s cluster, hosted on Ubuntu, that will use a NFS share for the postgres volume. From my reading I have done the following.

  1. Installed the necessary CSI driver for microk8s.
  2. Created an NFS storage class.
# sc-nfs.yaml
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
  server: ip_address
  share: /srv/pg_share
allowVolumeExpansion: true
volumeBindingMode: Immediate
mountOptions:
  - hard
  - nfsvers=4.1
  1. Specified the NFS storage class to be used in my custom values passed to helm for deploying awx-operator.
# my_values.yaml
---
AWX:
  enabled: true
  name: awx
  spec:
    admin_user: admin
    hostname: lab.mydomain

customVolumes:
  postgres:
    enabled: true
    hostPath: /srv/pg_share
    size: 15Gi
    storageClassName: nfs-csi
  1. Again, specified the storage class for the ansible deployment. Not entirely sure that this step is necessary.
# awx-deploy.yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  service_type: nodeport

  postgres_storage_class: nfs-csi
  postgres_storage_requirements:
    requests:
      storage: 15Gi

My problem is that when I deploy awx-operator with the helm chart it doesn’t successfully create the postgres pod, and is in an Error state. Viewing the pods events I see the below failure reason.

“Back-off restarting failed container postgres in pod awx-postgres-15-0_awx(40400b95-67f0-4d86-91d6-8663e3bc671f)”

When I view the NFS folder I see the folder created by the claim, with a ‘data’ subfolder.

Any help would be greatly appreciated.

Anyone have any thoughts on this? Or suggestions on other places for me to post my question?

Thank you.

Hey @augray ,

I don’t have access to my config right now but my issues in the past with deploying Postgres on K8s with NFS backed storage was related to permissions. The Postgres container would create the folder but fail when it went to create the DB files. There is a setting that I used to force the user security context which allowed it work. This wasn’t part of my AWX deployment but can probably be specified using one of the AWX operator overrides. The other option would be to deploy Postgres separately then specify the connection details in your AWX deployment/config.

If I can get some time tonight I’ll post a sanitized config. In the meantime, you can take a look at K8s security contexts Configure a Security Context for a Pod or Container | Kubernetes

Best regards,

Joe

Hi @iwt-cmd ,

Thank you for your response. I think you may have set me on the path I need to be on. I’ll update the thread later after I’ve tried a couple of things.

Best,
Nick