kubernetes-client/java

how to get or change context

Closed this issue · 3 comments

Good afternoon! Please tell me how to do kubectl config context get-contexts on k8s java client, I want to get cluster but I don't understand how.

Get contexts: https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/util/KubeConfig.java#L147

Set context: https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/util/KubeConfig.java#L114

Good afternoon! The question is how do I get the context if I use inCluster, without kubeConfig:

ApiClient client = ClientBuilder.cluster().build();

@Antirecord Did you figure this out?