I managed to get everything working. Operator in my test environment is now 2.19.1 and AWX is now 24.6.1. All jobs seem to run OK.
Next problem: I see the following in the kubernetes logs for the task pod:
2025-03-11 09:23:32,445 ERROR [42fad36abd6347e0b05c55e8a3dced39] awx.main.scheduler Failed to list pods for container group AWX - Timeout Workaround-5
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/awx/main/scheduler/kubernetes.py", line 28, in list_active_jobs
for pod in pm.kube_api.list_namespaced_pod(pm.namespace, label_selector='ansible-awx={}'.format(settings.INSTALL_UUID)).to_dict().get('items', []):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/api/core_v1_api.py", line 15823, in list_namespaced_pod
return self.list_namespaced_pod_with_http_info(namespace, **kwargs) # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/api/core_v1_api.py", line 15942, in list_namespaced_pod_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/api_client.py", line 348, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
response_data = self.request(
^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/api_client.py", line 373, in request
return self.rest_client.GET(url,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/rest.py", line 244, in GET
return self.request("GET", url,
^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/kubernetes/client/rest.py", line 238, in request
raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Audit-Id': '884eb906-50fc-478f-8f08-93b8256308ff', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': '8c87fe40-0bbd-44cf-abe8-5b13ccfacb2f', 'X-Kubernetes-Pf-Prioritylevel-Uid': '37fa4d23-016b-4bbb-86e4-3c2a5825b70b', 'Date': 'Tue, 11 Mar 2025 09:23:32 GMT', 'Content-Length': '283'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"pods is forbidden: User \"system:serviceaccount:awxtest:awxtest\" cannot list resource \"pods\" in API group \"\" in the namespace \"awx-test\"","reason":"Forbidden","details":{"kind":"pods"},"code":403}
I searched for this error and found a few blogs that explained a role/rolebinding should be created for the service account. I created the following role and rolebinding and applied it:
kind: Role
metadata:
name: pod-reader
namespace: awxtest
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-pods
namespace: awxtest
subjects:
- kind: ServiceAccount
name: awxtest
namespace: awxtest
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io
But this didn’t solve the problem.
Questions:
- Is this really a problem, or just a cosmetic error?
- If it’s a problem, how can this be solved?