How to install AWX Ansible Tower to MicroK8s

Install and prepare MicroK8s

sudo snap install microk8s --classic

You need to run following commands. It allows you to run commands without needing sudo privileges:

sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
exit

Enable necessary add-ons:

microk8s enable storage dns ingress

Create alias and you can use just kubectl:

sudo snap alias microk8s.kubectl kubectl

Clone from git awx-operator and deploy to MicroK8s:


git clone https://github.com/ansible/awx-operator.git
cd awx-operator

Check awx-operator releases by link below:

https://github.com/ansible/awx-operator/releases

Change branch for current release and deploy awx-operator:

git checkout 0.22.0
export NAMESPACE=ansible-awx
sudo apt install make
make deploy

Wait while operator will be deployed and verifying with command below:

kubectl get pods -n $NAMESPACE

You have to see something like:

Create a YAML file with the following and Deploy AWX:

nano my-awx.yml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-demo
spec:
  service_type: nodeport

Apply yaml file:

kubectl apply -f my-awx.yml -n ansible-awx

Check status of deployment following commands:

kubectl get pods -n $NAMESPACE
watch kubectl get pods -l "[app.kubernetes.io/managed-by=awx-operator](http://app.kubernetes.io/managed-by=awx-operator)" -n ansible-awx

You have to see 4/4 containers running.

Let’s create Ingress file with following rule

nano my-awx-ingress.yml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-demo
spec:
  service_type: nodeport
  ingress_type: ingress
  hostname: awx.test.me

And now apply new ingress settings:

kubectl apply -f my-awx-ingress.yml -n ansible-awx

Once a settings is applied you have opportunity to access AWX by 80 port.

http://awx.test.me

The default username is admin. The password randomly generated. For this you need to do following command:

kubectl get secret awx-demo-admin-password -n ansible-awx -o jsonpath='{.data.password}' | base64 --decode