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?
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.