I'm working locally (within Docker for Mac) on a Kubernetes cluster that will eventually be deployed to the cloud. We plan to use a database service in that environment. To simulate that, I'd like to have the services in the cluster connect to a database running outside the cluster on my laptop.
Can I do that? Here's what I thought I'd try.
- Define a
Service
withtype: ExternalName
andexternalName: somedb.local
- Add
127.0.0.1 somedb.local
to/etc/hosts
on the laptop
Is that correct? Is there a better way?