Problem mapping extra volume to AWX

I tried to mount a volume from my K3s host to AWX using the guide from awx but I get the error:

strict decoding error: unknown field “spec.init_container_extra_volume_mounts[0].mount”, unknown field “spec.init_container_extra_volume_mounts[0].name”

My awx.yaml file is the next:

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  # These parameters are designed for use with:
  # - AWX Operator: 2.17.0
  #   https://github.com/ansible/awx-operator/blob/2.17.0/README.md

  admin_user: admin
  admin_password_secret: awx-admin-password

  ingress_type: ingress
  ingress_hosts:
    - hostname: ###########
      tls_secret: awx-secret-tls

  postgres_configuration_secret: awx-postgres-configuration

  postgres_data_volume_init: true
  postgres_storage_class: awx-postgres-volume
  postgres_storage_requirements:
    requests:
      storage: 8Gi

  projects_persistence: true
  projects_existing_claim: awx-projects-claim

  web_replicas: 1
  task_replicas: 1

  web_resource_requirements:
    requests:
      cpu: 100m
      memory: 128Mi
    limits:
      cpu: 2000m
      memory: 6Gi
  task_resource_requirements:
    requests:
      cpu: 100m
      memory: 128Mi
      ephemeral-storage: 500M
    limits:
      cpu: 4000m
      memory: 8Gi
      ephemeral-storage: 4Gi
  extra_volumes: |
    - name: awx-data-volume
      persistentVolumeClaim:
        claimName: awx-data-claim
  init_container_extra_volume_mounts:
    - name: awx-data-volume
      mount: /data_awx
  init_container_extra_commands: |
    chmod 775 /data_awx
    chgrp 1000 /data_awx
  ee_resource_requirements: {}
  init_container_resource_requirements: {}
  postgres_resource_requirements: {}
  redis_resource_requirements: {}
  rsyslog_resource_requirements: {}

  # Uncomment to reveal "censored" logs
  #no_log: false

My pv.yaml is the next:

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-postgres-15-volume
spec:
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  capacity:
    storage: 8Gi
  storageClassName: awx-postgres-volume
  hostPath:
    path: /data_awx/postgres

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-projects-volume
spec:
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  capacity:
    storage: 2Gi
  storageClassName: awx-projects-volume
  hostPath:
    path: /data_awx/project

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-data-volume
spec:
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  capacity:
    storage: 20Gi
  storageClassName: awx-data-volume
  hostPath:
    path: /data_awx/data

And my pvc.yaml is:

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: awx-projects-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 2Gi
  storageClassName: awx-projects-volume

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: awx-data-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 20Gi
  storageClassName: awx-data-volume

Please your help. Thanks in advance.

I think you gave it a list when it expects a multi-line string like the other values.

https://ansible.readthedocs.io/projects/awx-operator/en/latest/user-guide/advanced-configuration/custom-volume-and-volume-mount-options.html

Thanks Denny, with that the error no longer appears but when I login inside the pod the path does not appear.

bash-5.1$ pwd
/
bash-5.1$ df -h
Filesystem                      Size  Used Avail Use% Mounted on
overlay                          54G   27G   25G  52% /
tmpfs                            64M     0   64M   0% /dev
/dev/mapper/ubuntu--vg-lv--var   12G  1.1G   11G  10% /etc/hosts
shm                              64M  144K   64M   1% /dev/shm
/dev/mapper/app_vg-lv_rancher    54G   27G   25G  52% /etc/hostname
tmpfs                            16G  8.0K   16G   1% /etc/receptor/work_private_key.pem
tmpfs                            16G  4.0K   16G   1% /etc/tower/SECRET_KEY
/dev/mapper/app_vg-awx_lv_proj  3.0G  225M  2.8G   8% /var/lib/awx/projects
tmpfs                            16G   12K   16G   1% /etc/tower/conf.d/ldap.py
tmpfs                            16G   12K   16G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs                           7.9G     0  7.9G   0% /proc/acpi
tmpfs                           7.9G     0  7.9G   0% /proc/scsi
tmpfs                           7.9G     0  7.9G   0% /sys/firmware
bash-5.1$ cd /data_awx
bash: cd: /data_awx: No such file or directory

You have configured the volume, mounted it to the init container and processed the permissions with the init commands. You have not mounted the volume anywhere else.

Please see the following table excerpt from the link above to determine where all you want the volume to be mounted:

Name Description Default
extra_volumes Specify extra volumes to add to the application pod ‘’
web_extra_volume_mounts Specify volume mounts to be added to Web container ‘’
task_extra_volume_mounts Specify volume mounts to be added to Task container ‘’
rsyslog_extra_volume_mounts Specify volume mounts to be added to Rsyslog container ‘’
ee_extra_volume_mounts Specify volume mounts to be added to Execution container ‘’
init_container_extra_volume_mounts Specify volume mounts to be added to Init container ‘’
init_container_extra_commands Specify additional commands for Init container ‘’

Thanks for your help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.