What happened
After upgrading from kubernetes==35.0.0 to kubernetes==36.0.0, all API calls
made via load_incluster_config() are rejected with 403 Forbidden and
User "system:anonymous", resulting in requests being treated as unauthenticated.
Downgrading back to kubernetes==35.0.0 immediately resolves the issue with
zero other changes.
Environment
- Kubernetes version: GKE
v1.32.4
- Python client version:
kubernetes==36.0.0 (broken), kubernetes==35.0.0 (working)
- Python version:
3.11
- Container image:
python:3.11-slim
- Runtime environment: Python application running inside a Docker container on GKE
- Authentication method:
config.load_incluster_config() using mounted ServiceAccount token
- Cloud: Google Kubernetes Engine (GKE) with Workload Identity enabled
How to reproduce
- Run a pod on GKE with Workload Identity enabled on the node pool
- Use
kubernetes==36.0.0
- Call
config.load_incluster_config() followed by any API call:
from kubernetes import client, config
config.load_incluster_config()
v1 = client.CoreV1Api()
v1.list_pod_for_all_namespaces(watch=False) # 403 — system:anonymous
What you expected to happen
Requests should authenticate as the pod's ServiceAccount, same as v35.0.0.
What actually happened
(403)
Reason: Forbidden
HTTP response body:
{
"message": "pods is forbidden: User \"system:anonymous\" cannot list resource \"pods\" in API group \"\" at the cluster scope"
}
Anything else we need to know?
Additional validation performed:
- ServiceAccount token exists correctly at:
/var/run/secrets/kubernetes.io/serviceaccount/token
kubectl auth can-i confirms RBAC permissions are valid
- Raw authenticated requests using the mounted token succeed
- Only the Python Kubernetes client in
v36.0.0 fails
Confirmed workaround:
What happened
After upgrading from
kubernetes==35.0.0tokubernetes==36.0.0, all API callsmade via
load_incluster_config()are rejected with403 ForbiddenandUser "system:anonymous", resulting in requests being treated as unauthenticated.Downgrading back to
kubernetes==35.0.0immediately resolves the issue withzero other changes.
Environment
v1.32.4kubernetes==36.0.0(broken),kubernetes==35.0.0(working)3.11python:3.11-slimconfig.load_incluster_config()using mounted ServiceAccount tokenHow to reproduce
kubernetes==36.0.0config.load_incluster_config()followed by any API call:What you expected to happen
Requests should authenticate as the pod's ServiceAccount, same as
v35.0.0.What actually happened
Anything else we need to know?
Additional validation performed:
/var/run/secrets/kubernetes.io/serviceaccount/tokenkubectl auth can-iconfirms RBAC permissions are validv36.0.0failsConfirmed workaround: