John
John

Reputation: 119

AWX on Kubernetes trying to add host folder to project directory on container for AWX UI to have access to local playbooks

Working with AWX on Kubernetes I was able to create a local folder and pass it to the web container but the AWX UI does not see the playbooks but the container does.

Can anyone share documentation on how to expose from a localhost /path to the AWX UI?

Here is my deployment file:


apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  service_type: nodeport
  projects_persistence: true
  projects_storage_access_mode: ReadWriteOnce
  web_extra_volume_mounts: |
    - name: static-data
      mountPath: /var/lib/projects
    - name: manual-projects
      mountPath: /var/lib/awx/projects


  extra_volumes: |
    - name: static-data
      persistentVolumeClaim:
        claimName: public-static-data-pvc
    - name: manual-projects
      hostPath:
        path: /var/lib/awx/projects

When I execute this on the container I'm able to see the path and file

> [lab01@localhost awx-operator]$ kubectl exec -it deploy/awx-web -c
> awx-web -n awx -- ls -l /var/lib/awx/projects/
> -rwxrwxr-x. 1 awx root 142 Jan 31 21:34 playbook.yml

but on the AWX UI I'm not.

Upvotes: 0

Views: 426

Answers (2)

DevGW
DevGW

Reputation: 703

When I added a remote mount for a directory I had to create a new instance group and then assign that instance group to any jobs that I wanted to be able to use it.

I know that may not be exactly what you are trying to accomplish but thought the direction may help find your solution.

This is what I have in my podspec override for the instance group:

apiVersion: v1
kind: Pod
metadata:
  namespace: awx
spec:
  serviceAccountName: default
  automountServiceAccountToken: false
  containers:
    - image: quay.io/ansible/awx-ee:latest
      name: worker
      args:
        - ansible-runner
        - worker
        - '--private-data-dir=/runner'
      resources:
        requests:
          cpu: 250m
          memory: 100Mi
      volumeMounts:
        - name: awx-reports-storage
          mountPath: /var/www/html/reports
  volumes:
    - name: awx-reports-storage
      persistentVolumeClaim:
        claimName: awx-reports-pvc

Upvotes: 0

Justin Yu
Justin Yu

Reputation: 61

You can try kubectl port-forward

Example

kubectl port-forward pods/awx-xxxxxxxxx-xxxxx 8080:80

Where 8080 is your local port, you can try to browse locally with localhost:8080 for your UI

Upvotes: 0

Related Questions