Skip to content

Instantly share code, notes, and snippets.

@alexolinux
Last active November 1, 2025 14:05
Show Gist options
  • Select an option

  • Save alexolinux/3bd148cace1b935643fc1f42523d4bb4 to your computer and use it in GitHub Desktop.

Select an option

Save alexolinux/3bd148cace1b935643fc1f42523d4bb4 to your computer and use it in GitHub Desktop.
AWX Operator on K8s Installation

AWX K8s Installation


  1. Preparation
mkdir AWX && cd AWX && \
  git clone https://github.com/ansible/awx-operator.git && \
  cd awx-operator/ && \
  git tag |tail && \
  git checkout tags/2.9.0 && export VERSION=2.9.0 && \
  make deploy

Steps 2, 3, and 4 should be used only in case the default AWX volumes fail to run.

  1. Create storage class
cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
EOF
  1. Create PV (host path must exist)
mkdir -p $HOME/.kube/data/awx
chmod 777 $HOME/.kube/data/awx   # for quick testing
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-postgres-pv
spec:
  capacity:
    storage: 8Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: $HOME/.kube/data/awx
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                - k3d-awx-agent-0
                - k3d-awx-agent-1
EOF

Change the nodeSelectorTerms values according to youy worker nodes

  1. PVC that binds to the PV
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: awx-postgres-pvc
  namespace: awx
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 8Gi
  storageClassName: local-storage
EOF
  1. Apply the AWX CR (awx-demo.yml)
kubectl -n awx apply -f awx-demo.yml
  1. Checking Pods and Services
kubectl -n awx get pods -l "app.kubernetes.io/managed-by=awx-operator"
kubectl -n awx get svc -l "app.kubernetes.io/managed-by=awx-operator"
  1. Get admin password (Default User: admin)
kubectl get secret awx-demo-admin-password -n awx -o jsonpath="{.data.password}" | base64 --decode

Reference

https://ansible.readthedocs.io/projects/awx-operator/en/latest/installation/basic-install.html https://github.com/ansible/awx-operator/tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment