I am using a feature in nginx that requires specifying a resolver, otherwise I would just rely on the resolve.conf
host resolver configuration provided by kubernetes.
What I'm wondering is if the service name kube-dns.kube-system.svc.cluster.local
would be considered by the kubernetes project to be stable for backcompat purposes so that I can rely on it to not disappear in minor releases.
server {
listen 443 ssl;
server_name "~^(?<host_name>host-[0-9a-z]{7,10}).domain.tldquot;;
ssl_certificate /etc/ssl/certs/chained.crt;
ssl_certificate_key /etc/ssl/private/my.key;
# Use a variable here to force nginx to respect DNS ttl and reresolve
# See: https://tenzer.dk/nginx-with-dynamic-upstreams/
resolver kube-dns.kube-system.svc.cluster.local;
set $downstream_api http://hostapi.default.svc.cluster.local:3000;
location / {
proxy_pass $downstream_api;
}
}
The suffix piece (cluster.local
) is configurable cluster to cluster, but I think you can feel confident that the dns will be consistent throughout releases. It did change very early on, but hasn't since.