-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
I'm running my python code inside a pod, please see below:
from kubernetes import client, config
config.load_incluster_config()
api_client = client.ApiClient()
core_version = api_client.call_api('/api', 'GET', response_type='object')[0]
or
discovery = client.ApisApi(api_client)
api_versions = discovery.get_api_versions()
And getting the next issue:
"apiVersion":"v1","metadata":{},"status":"Failure","message":"forbidden: User "system:anonymous" cannot get path "/api"","reason":"Forbidden","details":{},"code":403
When I try to do the same but with
config.load_kube_config(config_file=KUBE_CONFIG_FILE)
instead of
config.load_incluster_config()
everything is working fine.
I've attached service account with full admin permission to the pod. I'm able to see token in file /var/run/secrets/kubernetes.io/serviceaccount/token inside the pod.
Kubernetes lib version is kubernetes==33.1.0.
Could you please assist with the issue ?
Metadata
Metadata
Assignees
Labels
No labels