I am trying to build a kubernetes python app using a docker container but keep getting this error.
if os.getenv('KUBERNETES_SERVICE_HOST'):
config.load_incluster_config()
else:
config.load_kube_config()
However, the file exists
Where is the .kube/config file? in host directory or in container ?
As far as I know, in a container we normally use the incluster_config to connect to the api server, if we have the env KUBERNETES_SERVICE_HOST configured, which injected into the pod by kubelet automatically. So try to setup the env KUBERNETES_SERVICE_HOST when you start the container.