Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

How to Authenticate GKE Cluster on Kubernetes API Server using its Java client library

I am retrieving a list of Clusters from GKE using GKE Rest API. Next, I need to retrieve containers information from Kubernetes API Server for a particular GKE cluster. There are two authentication methods known to me which can be used to authenticate a cluster with Kubernetes API. First One is Basic Authentication and the second one is Authentication using client certificate and client key. I have found out Here that both of these approaches are no more recommended.

My question is that what other authentication method I can use to authenticate my GKE cluster with Kubernetes API using its Java client library.

question from:https://stackoverflow.com/questions/65858258/how-to-authenticate-gke-cluster-on-kubernetes-api-server-using-its-java-client-l

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The java client should be able to find the pod's service account and authenticate itself within a cluster, and use a kubeconfig file to authenticate when outside cluster. The default location to look for a kubeconfig file is HOME/.kube/config

When outside the cluster, the gcloud container clusters get-credentials ... command will create a kubeconfig file with proper helper configuration to authenticate. Presumably there is a java way to set up a kubeconfig file without running gcloud from a shell in the google-cloud-container library.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...