Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s Python interface issue #2222

Open
Jicming opened this issue Apr 29, 2024 · 2 comments
Open

K8s Python interface issue #2222

Jicming opened this issue Apr 29, 2024 · 2 comments
Labels
kind/documentation Categorizes issue or PR as related to documentation.

Comments

@Jicming
Copy link

Jicming commented Apr 29, 2024

When I was experimenting with the Python client, I found a configuration that I didn't know what to fill in as follows:

configuration.api_key['authorization'] = 'YOUR_API_KEY'

@Jicming Jicming added the kind/documentation Categorizes issue or PR as related to documentation. label Apr 29, 2024
@roycaihw
Copy link
Member

roycaihw commented May 8, 2024

Please take a look at the examples on how to use this client

@Jicming
Copy link
Author

Jicming commented May 14, 2024

下面这个例子中 configuration.api_key['authorization'] = 'YOUR_API_KEY' 这块填啥呢?

from future import print_function
import time
import kubernetes.client
from kubernetes.client.rest import ApiException
from pprint import pprint

configuration = kubernetes.client.Configuration()

Configure API key authorization: BearerToken

configuration.api_key['authorization'] = 'YOUR_API_KEY'

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix['authorization'] = 'Bearer'

Defining host is optional and default to http://localhost

configuration.host = "http://localhost"

Defining host is optional and default to http://localhost

configuration.host = "http://localhost"

Enter a context with an instance of the API kubernetes.client

with kubernetes.client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = kubernetes.client.WellKnownApi(api_client)

try:
    api_response = api_instance.get_service_account_issuer_open_id_configuration()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling WellKnownApi->get_service_account_issuer_open_id_configuration: %s\n" % e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation.
Projects
None yet
Development

No branches or pull requests

2 participants