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

KatibClient can not use on application which out the k8s cluster #2046

Closed
zhangxueren9 opened this issue Dec 1, 2022 · 4 comments
Closed

Comments

@zhangxueren9
Copy link

I want to use katib client in my ec2 which is out from the k8s cluster
my code

import kubeflow.katib as katib
katib_cli = katib.KatibClient()

print(katib_cli.list_experiments())

the code run good in cluster

but in my ec2
thow this error

so how do I use katibClient in my ec2?

RuntimeError: There was a problem to get experiments in namespace default. Exception: HTTPSConnectionPool(host='xxxx', port=443): Max retries exceeded with url: /apis/kubeflow.org/v1beta1/namespaces/default/experiments (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)')))

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@andreyvelich
Copy link
Member

Sorry for the late reply @zhangxueren9.

You can use client_configuration in KatibClient to access your Kubernetes cluster.
For example:

  1. Obtain SA Token which has required RBAC in your Kubernetes Cluster
  2. Create KatibClient as follows:
from kubernetes import client
from kubeflow.katib import KatibClient

TOKEN = "<ADD TOKEN HERE>"

configuration = client.Configuration()

# API Server URL
configuration.host = "<EKS_API_SERVER_URL>"

# Service Account Token
configuration.api_key["authorization"] = TOKEN
configuration.api_key_prefix["authorization"] = "Bearer"

# List of Experiments.
katib_client = KatibClient(client_configuration=configuration)
print(katib_client.list_experiments(namespace="<USER_NAMESPACE>"))
  1. Check this example: https://github.com/kubernetes-client/python/blob/67f9c7a97081b4526470cad53576bc3b71fa6fcc/examples/remote_cluster.py#L31

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Copy link

This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants