AWX Kubernetes

Hello,

I want to setup an Awx Ha environment using Kubernetes . Our Organization has Kubernetes and we want to leverage K8.
Have few questions regarding the Ansible Playbook for awx .

  1. Does the playbook for K8 deploys the containers on all the Worker Nodes in the cluster ?

  2. I am not able to find any task in the playbook that creates the replicasets for the Pod’s in which the awx container runs. Should we deploy additional Pod’s or replica sets after the one time installation is completed ?

  3. Does have any one has recommendation on how Postgres should run ? Is it ok to run Postgres in the same Pod as awx_web/task, rabbitmq, memcached ? If Postgres should be external, how do we set that up in K8 ?

Please let me know if I would need to consider any thing else in general while setting up HA like environment in Kubernetes based on your experience .

Thanks,

Just FYI, there is an automated solution already available at for docker standalone method instead of Kubernetes. Check the below unofficial repository for more details which we are maintaining,

https://github.com/sujiar37/AWX-HA-InstanceGroup

Thanks & Regards,
Sujith

Scaling awx in kubernetes/openshift is simply increasing the number of awx instances. Rest should be working automatically.
For automatic increase I guess you can set it here:
https://github.com/ansible/awx/blob/devel/installer/roles/kubernetes/defaults/main.yml#L44
but I only tried that post-install not during install

Thanks Klaas… By increasing awx instances, how does the Load of Job runs gets distributed as the instances are not clustered ?

Thanks Sujith . Will try this , but our team wants to go with the Kubernetes way.

Thanks Klaas.. By increasing awx instances, how does the Load of Job runs gets distributed as the instances are not clustered ?

https://docs.ansible.com/ansible-tower/latest/html/userguide/job_slices.html is that what you're searching for?

Yes… Job Slicing helps with running a given single job using all cluster nodes in Tower and by splitting the Inventory as well which is the case with the licensed version.
In Kubernetes, additional instances might help with failover(If a Pod goes down, awx can still be served from other Pod ip ), but how are the Jobs sliced across Tower nodes since
K8 is not similar to cluster based installation like Redhat/awx Ha .

I think it should be exactly the same for awx in kubernetes as tower in kubernetes :slight_smile:
https://github.com/ansible/awx/blob/a1fe60da78445c7970eaa823e88ce21860053785/docs/job_slicing.md

Hello Praveen,

Did you find any way to implement AWX HA/Cluster in kubernetes?

Even I’ve a requirement for the same solution. Please let us know.

Regards,
Vibin

Hello,

I would like to implement AWX HA/Cluster in Kubernetes too but I can’t deploy AWX with the “official” documentation (https://github.com/ansible/awx/blob/devel/INSTALL.md#kubernetes) .
I have just uncomment the "kubernetes_context" and "kubernetes_namespace" parameters in the default inventory file but I have this error when I run the deployment.

inventory:

localhost ansible_connection=local ansible_python_interpreter=“/usr/bin/env python”

[all:vars]

dockerhub_base=ansible
dockerhub_version=9.0.1

Kubernetes Install

kubernetes_context=awx-cluster
kubernetes_namespace=awx

TASK [kubernetes : Get Namespace Detail] ******************************************************************************************************************
task path: /root/Kub-awx-install.9.0.1/awx/installer/roles/kubernetes/tasks/kubernetes.yml:2
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: “kubectl get namespace awx”, “delta”: “0:00:00.313356”, “end”: “2019-11-06 08:30:31.489015”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-11-06 08:30:31.175659”, “stderr”: “error: the server doesn’t have a resource type "namespace"”, “stderr_lines”: ["error: the server doesn’t have a resource type "namespace""], “stdout”: “”, “stdout_lines”: }
…ignoring

TASK [kubernetes : Create AWX Kubernetes Project] *********************************************************************************************************
task path: /root/Kub-awx-install.9.0.1/awx/installer/roles/kubernetes/tasks/kubernetes.yml:7
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: “kubectl create namespace awx”, “delta”: “0:00:00.152700”, “end”: “2019-11-06 08:30:31.863581”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-11-06 08:30:31.710881”, “stderr”: “error: no matches for kind "Namespace" in version "v1"”, “stderr_lines”: [“error: **no matches for kind "Namespace" in version "v1**”"], “stdout”: “”, “stdout_lines”: }

PLAY RECAP ************************************************************************************************************************************************
localhost : ok=8 changed=2 unreachable=0 failed=1 skipped=39 rescued=0 ignored=1

When I check the Kube config file which is created in /root/.kube/config is :

apiVersion: v1
clusters:
contexts:

  • context:
    cluster: “”
    user: “”
    name: awx-cluster
    current-context: “”
    kind: Config
    preferences: {}
    users:

Any idea ???
Thanks :slight_smile:

I’ve found even running as a k8s admin account, you need to create the namespace before being able to use it. So:
kubectl create namespace awx, or oc new-project awx