You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v36.0.0 regression: load_incluster_config() sends requests as system:anonymous on GKE #2592
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.
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"
}
While I understand this likely stems from the same underlying regression in v36.0.0 (the BearerToken vs authorization key change), I believe the observed behavior here is different enough to be worth highlighting separately.
Unlike the 401 Unauthorized reported in #2584 and #2591, my cluster setup results in a 403 Forbidden with system:anonymous. This appears to happen in environments like GKE where a missing token is treated as an anonymous request rather than being rejected immediately as unauthorized.
So while the root cause may be the same, I think this issue provides a useful additional data point for the 403 system:anonymous scenario, which might not be immediately obvious from the existing reports.
If this is already covered by the fix in PR #2585, feel free to close this as a duplicate — I just wanted to make sure this specific behavior is captured.
We have the same issue when using the ansible kubernetes.core.k8s module with 36.0.0 and 36.0.1 with openshift. The 36.0.1 update has not resolved the issue. Using 35.0.0 works
Pinned kubernetes==35.0.0 to keep the operator image on the last verified working Kubernetes Python client version.
We compared the images:
previous working image: kubernetes==35.0.0
rebuilt failing image: kubernetes==36.0.2
With 36.0.2, Kopf logs authentication as successful, but Kubernetes API requests are handled as system:anonymous.
Although that issue is marked fixed upstream, we still reproduce the behavior with 36.0.2 in our operator image, so we pin to 35.0.0 until a newer client version is verified in our cluster.
Pinned kubernetes==35.0.0 to keep the operator image on the last verified working Kubernetes Python client version.
We compared the images:
previous working image: kubernetes==35.0.0
rebuilt failing image: kubernetes==36.0.2
With 36.0.2, Kopf logs authentication as successful, but Kubernetes API requests are handled as system:anonymous.
Although that issue is marked fixed upstream, we still reproduce the behavior with 36.0.2 in our operator image, so we pin to 35.0.0 until a newer client version is verified in our cluster.
You also need kopf >= 1.44.6
If you upgrade kopf to the version the new version of kubernetes should work as expected.
Pinned kubernetes==35.0.0 to keep the operator image on the last verified working Kubernetes Python client version.
We compared the images:
previous working image: kubernetes==35.0.0
rebuilt failing image: kubernetes==36.0.2
With 36.0.2, Kopf logs authentication as successful, but Kubernetes API requests are handled as system:anonymous.
Although that issue is marked fixed upstream, we still reproduce the behavior with 36.0.2 in our operator image, so we pin to 35.0.0 until a newer client version is verified in our cluster.
You also need kopf >= 1.44.6
If you upgrade kopf to the version the new version of kubernetes should work as expected.
Thank a lot!
Confirm that it works with
kubernetes==36.0.2
kopf == 1.44.6
Confirmed this is still broken in 36.0.2, outside of kopf/ansible too — same system:anonymous symptom with a plain manual Configuration() for an external cluster.
Repro:
fromkubernetesimportclientconfiguration=client.Configuration()
configuration.api_key["authorization"] ="<token>"configuration.api_key_prefix["authorization"] ="Bearer"print(configuration.auth_settings())
# v34.1.0: value = 'Bearer <token>' (correct)# v36.0.2: value = '<token>' (missing "Bearer " prefix)
#2604 fixed the token lookup in auth_settings() by calling get_api_key_with_prefix('BearerToken', alias='authorization'), but get_api_key_with_prefix only applies alias to the key lookup, not the prefix one:
key=self.api_key.get(identifier, self.api_key.get(alias) ifaliasisnotNoneelseNone)
ifkey:
prefix=self.api_key_prefix.get(identifier) # never checks `alias`
So anyone who sets api_key_prefix['authorization'] (the old convention) gets a bearer token with no "Bearer " prefix. GKE treats that as anonymous. Same fix pattern should apply to the prefix lookup:
Activity
aojea commentedon May 22, 2026
This is a duplicate, a fix has been merged and a release is going to be cut soon
starboyhassan commentedon May 22, 2026
Thanks for looking into this.
While I understand this likely stems from the same underlying regression in
v36.0.0(theBearerTokenvsauthorizationkey change), I believe the observed behavior here is different enough to be worth highlighting separately.Unlike the
401 Unauthorizedreported in #2584 and #2591, my cluster setup results in a403 Forbiddenwithsystem:anonymous. This appears to happen in environments like GKE where a missing token is treated as an anonymous request rather than being rejected immediately as unauthorized.So while the root cause may be the same, I think this issue provides a useful additional data point for the
403 system:anonymousscenario, which might not be immediately obvious from the existing reports.If this is already covered by the fix in PR #2585, feel free to close this as a duplicate — I just wanted to make sure this specific behavior is captured.
yliaog commentedon May 26, 2026
https://github.com/kubernetes-client/python/releases/tag/v36.0.1 has been released, it should fix the issue. Could you please give it a try?
markafarrell commentedon May 27, 2026
@yliaog it looks like this works but it appears to break some downstream libraries.
nolar/kopf#1307
yliaog commentedon May 27, 2026
@markafarrell thanks for confirming the fix.
please see
Breaking Change from upgrading openapi generator to v6.6.0:
https://github.com/kubernetes-client/python/blob/release-36.0/CHANGELOG.md#breaking-change-from-upgrading-openapi-generator-to-v660
yliaog commentedon May 27, 2026
@starboyhassan could you please try out the new release https://github.com/kubernetes-client/python/releases/tag/v36.0.1 to see if the particular case you saw is fixed ?
LTek-online commentedon May 28, 2026
We have the same issue when using the ansible kubernetes.core.k8s module with 36.0.0 and 36.0.1 with openshift. The 36.0.1 update has not resolved the issue. Using 35.0.0 works
MountainGG commentedon May 28, 2026
same issue, using k8s1.35.
yliaog commentedon May 28, 2026
@LTek-online @MountainGG
could you check if you are having the same problem as nolar/kopf#1307 ? if yes, then could you fix it on your side?
yliaog commentedon Jun 1, 2026
https://github.com/kubernetes-client/python/releases/tag/v36.0.2 has been released, please check if it helps fix the problem.
markafarrell commentedon Jun 2, 2026
@yliaog
36.0.2does not fix the the issue with nolar/kopf#1307kopfcallsconfig.get_api_key_with_prefix('authorization')36.0.2only fixes when accessing viaConfiguration.auth_settings()LTek-online commentedon Jun 2, 2026
@yliaog Tested the python kubernetes==36.0.2 module with the ansible module kubernetes.core.k8s and it works. 36.0.0 and 36.0.1 don't.
markafarrell commentedon Jun 4, 2026
FYI https://github.com/nolar/kopf/releases/tag/1.44.6
This version of kopf includes support >= v36.0.1
anastasiyatolstikenableu commentedon Jun 30, 2026
Pinned
kubernetes==35.0.0to keep the operator image on the last verified working Kubernetes Python client version.We compared the images:
kubernetes==35.0.0kubernetes==36.0.2With
36.0.2, Kopf logs authentication as successful, but Kubernetes API requests are handled assystem:anonymous.Although that issue is marked fixed upstream, we still reproduce the behavior with
36.0.2in our operator image, so we pin to35.0.0until a newer client version is verified in our cluster.markafarrell commentedon Jun 30, 2026
You also need kopf >= 1.44.6
If you upgrade kopf to the version the new version of kubernetes should work as expected.
anastasiyatolstikenableu commentedon Jul 1, 2026
Thank a lot!
Confirm that it works with
kubernetes==36.0.2
kopf == 1.44.6
HaimLC commentedon Jul 2, 2026
Confirmed this is still broken in 36.0.2, outside of kopf/ansible too — same
system:anonymoussymptom with a plain manualConfiguration()for an external cluster.Repro:
#2604 fixed the token lookup in
auth_settings()by callingget_api_key_with_prefix('BearerToken', alias='authorization'), butget_api_key_with_prefixonly appliesaliasto the key lookup, not the prefix one:So anyone who sets
api_key_prefix['authorization'](the old convention) gets a bearer token with no "Bearer " prefix. GKE treats that as anonymous. Same fix pattern should apply to the prefix lookup:Pinning to
<36.0.0(we're on 34.1.0) works around it :\Apply alias fallback to prefix lookup in get_api_key_with_prefix
Apply alias fallback to prefix lookup in get_api_key_with_prefix