Hi Everyone.
AWX is a powerful tool to help one wander the wonderful world of ansible. Obviously we are all keen to give the AWX operator a go in Kubernetes. Just like the song New York, New York (if I can make it there I cam make it anywhere) which translates into Kubernetarian + If I can install it on my laptop, I can install it anywhere!! We will attempt to do so on my old “chuck it in the bin already” Window$ laptop
You need to install my true love of late “Rancher Desktop”
Enable kubernetes and for convenience although optional turn on the wsl integration with your wsl distro:
I am using kubernetes v1.25.6 and remember in Rancher Desktop lurking under the hood is k3s.
Ok so we are ready to rumble!
open your Ubuntu terminal window and make sure your single node cluster is smilling:
kubectl get nodes
The awx-operator has all the instructions and I am basically following them with some tweaks for my local setup.
https://github.com/ansible/awx-operator
Let’s clone the repo
git clone https://github.com/ansible/awx-operator.git
We will change into that directory:
cd awx-operator
According to the instructions we need to install kustomize so let’s also update our distribution:
sudo apt update
sudo apt upgrade -y
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
We will create a kustomization.yaml file and I have filled in the latest version for the tag:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/ansible/awx-operator/config/default?ref=1.1.4
images:
- name: quay.io/ansible/awx-operator
newTag: 1.1.4
namespace: awx
Now we will run kustomize to install the operator:
./kustomize build . | kubectl apply -f -
We should see the pod appear:
kubectl get pods -n awx
You can switch contexts if you don’t want to constantly add the namespace in your command:
kubectl config set-context --current --namespace=awx
Now we will create an awx-demo.yml. You can change the one that they have provided in the repo folder:
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
service_type: clusterip
ingress_type: ingress
As you may have noticed we are going to set the service type a clusterip and use ingress.
Remember k3s by default with traefik turned on so your ingress should work out of the box.
Now lets apply that file:
kubectl apply -f awx.demo.yml
You have to be patient but eventually you should see database pod and an awx pod
Also the database is leveraging a pvc (k3s default local-path):
Remember if you want to get fancy and back this up you would need to use a Kasten generic backup since is not a csi driver and there is no snapshotting. We could of course make this post longer and install the csi-hostpath driver with snapshotting but I fear you could fall asleep :)
We can also see an ingress has also appeared:
Again be patient but after a little wait you should be able to navigate in your browser to:
Behold!
Great but now what do I do?
At this point try guessing the password. There probably a billion variations so this will keep you busy for a while.
Just joking!
You could have set the password in one of the config files but we want to have fun so:
kubectl get secrets -oyaml awx-demo-admin-password
The password is in there for the admin user but it is in base64 format so:
echo bjF2MXg0aldQTG1DSnhyT3owOGFsT0J5VG53TUNXNDQ= |base64 -d
Copy the result from your output and use that as a password for the admin user:
Boom!
Now you can setup ansible jobs to run on anything you want. Next time maybe I will turn on winrm on my laptop and have my AWX Tower setup in k3s sent it jobs to do, or I can tell my Linux servers hiding around the house to perform updates and patches.
Never a dull moment in the Burke home!