Max Kolasinski
01/05/2024, 5:09 PMkubernetes.client.exceptions.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': '5223f30c-bcf8-4a59-b2cf-202bc6b274be', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'f51bf68a-976a-47c9-a211-1b1194c0659b', 'Date': 'Fri, 05 Jan 2024 17:01:53 GMT', 'Content-Length': '295'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"events is forbidden: User \"system:serviceaccount:prefect:prefect-worker\" cannot list resource \"events\" in API group \"\" in the namespace \"prefect\"","reason":"Forbidden","details":{"kind":"events"},"code":403}
Can you help me figure out what is not configured correctly?Marvin
01/05/2024, 5:09 PMkube-system
namespace to identify the cluster. However, this requires permissions to read the kube-system
namespace, and if the necessary ClusterRole/ClusterRoleBinding are missing or if using helm template
or ArgoCD, the lookup
function may not be able to retrieve the UID, resulting in the worker not having a cluster identity at runtime.
From the information provided through a GitHub issue, it appears that a workaround is to manually override the clusterUUID
setting by supplying a cluster-unique identifier. If not overridden, the flow run cancellation feature may not work properly.
To resolve your issue, you might need to ensure that the Prefect worker has the necessary permissions to read the kube-system
namespace or manually provide a unique cluster identifier to avoid this error. If you are the administrator, you need to provide a cluster-unique setting for clusterUUID
to ensure correct behavior of flow run cancellation.
Please check your Kubernetes cluster's role-based access control (RBAC) settings to confirm that the system:serviceaccount:prefect:prefect-worker
service account has the appropriate permissions to list resources in the namespace where Prefect is installed. You may need to update or create the necessary ClusterRole and ClusterRoleBinding to grant these permissions. If you need exact guidance on the RBAC resources required or the process of manually setting the clusterUUID
, please refer to the Prefect documentation or consider reaching out to Prefect support for more personalized assistance.
If you need further information or have additional questions, feel free to ask!Max Kolasinski
01/05/2024, 5:13 PMMarvin
01/05/2024, 5:13 PMkubectl
must be available on the system to allow for interactions with the Kubernetes cluster.
- Remote Storage must be configured since local storage is not supported for Kubernetes Jobs.
RBAC in Kubernetes usually involves setting up roles and role bindings that define what actions a user or process can perform within the cluster. However, the specific RBAC requirements can vary based on what the Prefect deployment needs to do within your Kubernetes cluster, such as deploying workloads, accessing secrets, or modifying resources.
To get a precise list of RBAC permissions required by Prefect when deployed on Kubernetes, you would typically check the Prefect documentation or source code, where Kubernetes manifests are defined with roles and role bindings. If you need RBAC configurations, you might need to create roles with permissions to:
- Create, get, list, delete and update Kubernetes jobs and pods.
- Access secrets or config maps used for storing Prefect configuration or flow storage details.
- Additional permissions depending on custom configurations or resources used in your flows.
For detailed configurations, you might need to refer to the Prefect documentation in the deployment and setup sections specific to Kubernetes, or seek assistance from Prefect's community or support channels. If you have a particular concern or setup in mind, please let me know, and I can assist further.