Install AWX on K3S

  • 31 January 2023
  • 4 comments
  • 1373 views

Userlevel 7
Badge +22

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” 

 

https://rancherdesktop.io/

 

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
Operator Pod
 

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

Pods
 

Also the database is leveraging a pvc (k3s default local-path):
 

pvc

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:

Traefik rules!

 

Again be patient but after a little wait you should be able to navigate in your browser to: 

Behold!

AWX
 

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
secret
 

The password is in there for the admin user but it is in base64 format so:

 

echo bjF2MXg0aldQTG1DSnhyT3owOGFsT0J5VG53TUNXNDQ= |base64 -d
password

Copy the result from your output and use that as a password for the admin user:

 

Login Screen
 

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!

 


4 comments

Userlevel 7
Badge +20

Wow great post!  Something else to add to my “try it out” list. 😋

Userlevel 7
Badge +9

Great guide! Great tool for lab usage etc. compared to Ansible Tower! Would you use or recommend AWX in production?

Userlevel 7
Badge +22

Great guide! Great tool for lab usage etc. compared to Ansible Tower! Would you use or recommend AWX in production?

I think, if not mistaken that AWX is just another name for Ansible Tower, i.e. marketing talk about the same thing. 

As for production I think for certain. AWX or Tower, if I am correct about them being the same :)  are really just UI’s for ansible underneath which has a stellar reputation. There is a learning curve (which I am still on!) but speaking to people much more knowledgeable than myself in this field I get the message that ansible is huge tool that makes life a lot easier!

Userlevel 7
Badge +9

Great guide! Great tool for lab usage etc. compared to Ansible Tower! Would you use or recommend AWX in production?

I think, if not mistaken that AWX is just another name for Ansible Tower, i.e. marketing talk about the same thing. 

As for production I think for certain. AWX or Tower, if I am correct about them being the same :)  are really just UI’s for ansible underneath which has a stellar reputation. There is a learning curve (which I am still on!) but speaking to people much more knowledgeable than myself in this field I get the message that ansible is huge tool that makes life a lot easier!

+1… You are right. Tower is more commercial focused. For others that may also want to read about AWX/Tower: https://www.redhat.com/cms/managed-files/ma-ansible-vs-awx-datasheet-f13830wg-201808-en_0.pdf

 

 

Comment