fiaas / k8s

Python client library for the Kubernetes API
https://fiaas.github.io/
Apache License 2.0
39 stars 24 forks source link

Implement support for configuring k8s via kubeconfig #62

Open yunfan opened 5 years ago

yunfan commented 5 years ago

hi, i am a newbie of k8s. and i were using kubectl recently until i saw this library

were there any method to read those config from kubectl from its configure file located at ~/.kube/config

because i am not familiar with kubectl's config format, so i dont know which of it refer to the cert file in your tutorials

mortenlj commented 5 years ago

Currently there is no option to read config from the config file, but we probably should have that.

For simple cases, it's fairly easy to find the fields you need. Iirc, you need the server attribute from cluster, and possibly the certificate-data. You also need the username and password, or token from user. I don't recall exactly how it looks when using client certificates.

We are lacking some documentation on how to configure the library. You can have a look at many of the other repos under fiaas for examples. Most complete example is probably fiaas/fiaas-deploy-daemon.

mortenlj commented 5 years ago

Actually, I would like to keep this issue open, as a reminder that we need to look at the documentation, and possibly add some additional ways to configure the library.

mortenlj commented 2 years ago

This would be much easier if the python-base part of the official client was available as a dependency. I have opened an issue: https://github.com/kubernetes-client/python-base/issues/261