Skip to content

Kubernetes service registry will always use a file when passed an empty string #4244

@bobbytables

Description

@bobbytables

There's a logic flaw in this piece:
https://github.com/istio/istio/blob/master/pilot/pkg/serviceregistry/kube/client.go#L41-L50

Basically, if you pass an empty string to the resolver, it will always return username/.kube/config.

Reason being on line 41, it checks if the string is still empty, attempts to stat and empty string (which will always fail), and then assigns the kubeconfig string to a statically defined kubeconfig file which doesn't exist in in-cluster configurations.

This prevents using Istio in a Kubernetes In-cluster config.

Basically using the method with an empty string always returns an error:

kubernetes configuration file "/root/.kube/config" does not exist

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions