Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Last active October 30, 2022 10:59
Show Gist options
  • Save dmccuk/93db22e9b30d1963b8fca0de96fc82f0 to your computer and use it in GitHub Desktop.
Save dmccuk/93db22e9b30d1963b8fca0de96fc82f0 to your computer and use it in GitHub Desktop.

Install AWX-operator on Ubuntu 20 using Minikube

I’ve had a few requests for this demo as It seems like a lot of people are having issues setting up the new version of AWX. Before v18, (v17) you could simply install AWX on a server with enough resources. Now, the preferred way to install AWX is via the AWX-operator. So you need a Kubernetes or OpenShift cluster. For this demo, I’m using Minikube.

Subscribe To Me On YouTube: https://bit.ly/lon_sub

(if you get any errors, check the bottom of this page for the fix)

I’m using minikube because it’s a single node cluster and it keeps the price down. I did try this on a t2.medium, but there just weren’t enough resources to get it working.

This demo will cover the following:

  • Install and setup kubectl and docker.
  • Installing and setting up Minikube in EC2 [t3a.xlarge – 4 x cpu / 16gb memory]
    • ami-0194c3e07668a7e36
    • You might be able to get away with less resources)
  • Setup the AWX-operator (latest version – 0.10.0) and deploy.
  • Get the AWX admin password.
  • Forward the service port so we can access it from the internet and use minikube tunnel.
  • Login to AWX and take a quick tour.
  • All commands will be added into the description.

Make sure you have enough FREE Disk space. 10GB+ please

Links:

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

If you like the demo, hit subscribe for more videos like this and give it a like.

Commands:

setup the repo's:

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client
sudo apt-get update -y &&  sudo apt-get install -y docker.io

Install minikube:

There is an issue with the latest version (1.22) Please install 1.21 for now.

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/```

Use this one below for the time being:

curl -Lo minikube https://github.com/kubernetes/minikube/releases/download/v1.21.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
sudo usermod -aG docker $USER
LOGOUT & BACK IN AGAIN
groups $USER

minikube start

minikube start --addons=ingress --cpus=2 --install-addons=true --kubernetes-version=stable --memory=6g

Check its working:

kubectl get nodes
kubectl get pods
kubectl get pods -A

Install the AWX Operator:

kubectl apply -f https://raw.githubusercontent.com/ansible/awx-operator/0.10.0/deploy/awx-operator.yaml
kubectl get pods

Create the deployment file:

vi awx-demo.yml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-demo
spec:
  service_type: nodeport
  ingress_type: none
  hostname: awx-demo.example.com

Run the deployment:

kubectl apply -f awx-demo.yml
kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator"
kubectl get svc -l "app.kubernetes.io/managed-by=awx-operator"

WAIT A FEW MINS...

Get the Admin user password:

kubectl get secrets
kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode

Expose the deployment:

kubectl expose deployment awx-demo --type=LoadBalancer --port=8080

Minikube tunnel

On a new session, start the minikube tunnel:

minikube tunnel

Enable AWX to be access via the Internet:

kubectl port-forward svc/awx-demo-service --address 0.0.0.0 30886:80

Now visit https://your_ip:high_port

You may need to update your FW rules to be able to connect to the AWX login screen


--- ISSUES SECTION ---

  1. Starting minikube tunnel - Exiting due to GUEST_STATUS: state: unknown state "minikube": docker container inspect minikube --format=: exit status 1 ANS: sudo chmod 666 /var/run/docker.sock ; sudo usermod -aG docker ${USER}

  2. If you see the message: ImagePullBackOff or ErrImagePull when you run kubectl get pods, run the following command to see what the issue is:

kubectl describe pods <my-pod> # Output from "kubectl get pods" command for the pod with the issue.

I've seen a few issues where the server runs out of space so it should be easy to fix.

  1. If you have PENDING resources, try running a describe of the resource. If you see this at the bottom you are lacking in resources: ( kubectl describe pods <my-pod> # Output from kubectl get pods )
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  14s (x19 over 23m)  default-scheduler  0/1 nodes are available: 1 Insufficient cpu, 1 Insufficient memory.

This link has some more information: https://containersolutions.github.io/runbooks/posts/kubernetes/0-nodes-available-insufficient/

@dmccuk
Copy link
Author

dmccuk commented Oct 8, 2021

Did you create a larger VM to install AWX on [more CPU and more memory]? I would advise you delete the original VM, create a new one with enough resources and then follow the video again.

@day4me
Copy link

day4me commented Oct 15, 2021

hi, trying to use callback to provision my ec2 instance curl -H 'Content-Type: application/json' --data '{"host_config_key": "key"}' http://IP:30877/api/v2/job_templates/13/callback/ but I get this error: No matching host could be found!. I added HTTP_X_FORWARDED_FOR to configuration but it still doesn't work.

@max18-100
Copy link

Followed your instruction but only the awx-demo-postgres comes up. But no error message.
kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator"
NAME READY STATUS RESTARTS AGE
awx-demo-postgres-0 1/1 Running 0 35m

@nicolaibaralmueller
Copy link

Followed your instruction but only the awx-demo-postgres comes up. But no error message. kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" NAME READY STATUS RESTARTS AGE awx-demo-postgres-0 1/1 Running 0 35m

Using this one now. Very good.
https://github.com/kurokobo/awx-on-k3s

@dmccuk
Copy link
Author

dmccuk commented Jun 23, 2022

Followed your instruction but only the awx-demo-postgres comes up. But no error message. kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" NAME READY STATUS RESTARTS AGE awx-demo-postgres-0 1/1 Running 0 35m

Hi Max18-100. I've not looked at this for a long time! The thing that came up many times before was the VM not having enough resources. In my demo, I used a t3a.xlarge – 4 x cpu / 16gb memory in AWS. You will need at least 4 CPUs and 8GB memory for it to work properly.

I did try to get a T2.medium working (2CPU X 4GB) but it wasn't enough.

Does your VM have enough resources? Alternatively try the K3 install.: https://github.com/kurokobo/awx-on-k3s. I have another video with a demo on my channel here: https://www.youtube.com/watch?v=xVOnBDvpbK0

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