- 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 deploySteps 2, 3, and 4 should be used only in case the default AWX volumes fail to run.
- 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- 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
EOFChange the nodeSelectorTerms values according to youy worker nodes
- 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- Apply the AWX CR (awx-demo.yml)
kubectl -n awx apply -f awx-demo.yml- 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"- Get admin password (Default User: admin)
kubectl get secret awx-demo-admin-password -n awx -o jsonpath="{.data.password}" | base64 --decodehttps://ansible.readthedocs.io/projects/awx-operator/en/latest/installation/basic-install.html https://github.com/ansible/awx-operator/tags