Closed
Description
What happened (please include outputs or screenshots):
Error when trying to list EKS nodes or pods
return self.api.list_node(label_selector=label_selector, field_selector=field_selector).items
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/api/core_v1_api.py", line 17150, in list_node
return self.list_node_with_http_info(**kwargs) # noqa: E501
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/api/core_v1_api.py", line 17261, in list_node_with_http_info
return self.api_client.call_api(
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/api_client.py", line 348, in call_api
return self.__call_api(resource_path, method,
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
response_data = self.request(
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/api_client.py", line 373, in request
return self.rest_client.GET(url,
File "/home/AzDevOps/.local/lib/python3.10/site-packages/kubernetes/client/rest.py", line 244, in GET
return self.request("GET", url,
File "/home/AzDevOps/.local/lib/python3.10/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': '33e59936-e514-4ff3-8b96-34a0af79a236', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': '5c784c43-9cd3-4a50-9593-03c15141a761', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'c62bb07a-ffc7-4c7b-a8ba-fc542fd3c6d1', 'Date': 'Fri, 24 Jan 2025 00:32:24 GMT', 'Content-Length': '256'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"nodes is forbidden: User \"system:anonymous\" cannot list resource \"nodes\" in API group \"\" at the cluster scope","reason":"Forbidden","details":{"kind":"nodes"},"code":403}
What you expected to happen:
Should be able to list node just fine with function api.list_node()
How to reproduce it (as minimally and precisely as possible):
Create EKS cluster
Install kubernetes package version v32.0.0
Run following
from kubernetes import client, config
client = client.CoreV1Api()
client.list_node(label_selector=label_selector, field_selector=field_selector).items
Anything else we need to know?:
It was working fine with version v31.0.0 but failed after upgrading to version v32.0.0
Environment:
- Kubernetes version (
kubectl version
): v1.32.0 - OS (e.g., MacOS 10.13.6): Ubuntu 2204
- Python version (
python --version
) Python 3.10.12 - Python client version (
pip list | grep kubernetes
) v32.0.0
Metadata
Metadata
Assignees
Labels
Categorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.