Kubernetes Java client API

1/16/2020

I am trying to authenticate to the kubernetes cluster while using kubernetes java client API. I am using config file from .kube/config and pasting it into my project directory structure. But the config file has expiry time, and it expires so my API fails, also sometimes when i generate the kubeconfig file it does not contain expiry time, thus the API fails. How to get the permanent credentials for kubernetes cluster and use it in my code?

-- Sayali Saitawdekar
api
kubernetes

1 Answer

1/16/2020

Deploy the java application inside the kubernetes cluster as pod and use InClusterClientExample. In this case since the pod uses service account token it is guaranteed to work always because kubernetes takes care of refreshing the token.

-- Arghya Sadhu
Source: StackOverflow