Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable service discovery with environment variables in kubernetes?

Tags:

As we know, kubernetes supports 2 primary modes of finding a Service - environment variables and DNS, could we disable the first way and only choose the DNS way?

like image 885
zulv Avatar asked Jul 26 '17 10:07

zulv


1 Answers

As shown in this PR, this feature will land with Kubernetes v1.13. From the PR (as Docs are not available yet) I expect it to be the field enableServiceLinks in the pod spec with true as default.

Edit: It has been a while and the PR finally landed. The enableServiceLinks was added as an optional Boolean to the Kubernetes PodSpec.

For the record: using DNS to discover service endpoints is the recommended approach. The docker link behavior, from where the environment variables originate, has long been deprecated.

like image 177
Ohmen Avatar answered Oct 12 '22 09:10

Ohmen