You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.5 KiB

  1. K8s DNS stack by Kargo
  2. ======================
  3. Here is an approximate picture of how DNS things working and
  4. being configured by Kargo ansible playbooks:
  5. ![Image](figures/dns.jpeg?raw=true)
  6. Note that an additional dnsmasq daemon set is installed by Kargo
  7. by default. Kubelet will configure DNS base of all pods to use the
  8. given dnsmasq cluster IP, which is defined via the ``dns_server`` var.
  9. The dnsmasq forwards requests for a given cluster ``dns_domain`` to
  10. Kubedns's SkyDns service. The SkyDns server is configured to be an
  11. authoritative DNS server for the given cluser domain (and its subdomains
  12. up to ``ndots:5`` depth). Note: you should scale its replication controller
  13. up, if SkyDns chokes. These two layered DNS forwarders provide HA for the
  14. DNS cluster IP endpoint, which is a critical moving part for Kubernetes apps.
  15. Nameservers are as well configured in the hosts' ``/etc/resolv.conf`` files,
  16. as the given DNS cluster IP merged with ``nameservers`` values. While the
  17. DNS cluster IP merged with the ``upstream_dns_servers`` defines additional
  18. nameservers for the aforementioned nsmasq daemon set running on all hosts.
  19. This mitigates existing Linux limitation of max 3 nameservers in the
  20. ``/etc/resolv.conf`` and also brings an additional caching layer for the
  21. clustered DNS services.
  22. You can skip the dnsmasq daemon set install steps by setting the
  23. ``skip_dnsmasq: true``. This may be the case, if you're fine with
  24. the nameservers limitation. Sadly, there is no way to work around the
  25. search domain limitations of a 256 chars and 6 domains. Thus, you can
  26. use the ``searchdomains`` var to define no more than a three custom domains.
  27. Remaining three slots are reserved for K8s cluster default subdomains.
  28. When dnsmasq skipped, Kargo redefines the DNS cluster IP to point directly
  29. to SkyDns cluster IP ``skydns_server`` and configures Kubelet's
  30. ``--dns_cluster`` to use that IP as well. While this greatly simplifies
  31. things, it comes by the price of limited nameservers though. As you know now,
  32. the DNS cluster IP takes a slot in the ``/etc/resolv.conf``, thus you can
  33. specify no more than a two nameservers for infra and/or external use.
  34. Those may be specified either in ``nameservers`` or ``upstream_dns_servers``
  35. and will be merged together with the ``skydns_server`` IP into the hots'
  36. ``/etc/resolv.conf``.
  37. Kargo has yet ways to configure Kubedns addon to forward requests SkyDns can
  38. not answer with authority to arbitrary recursive resolvers. This task is left
  39. for future. See [official SkyDns docs](https://github.com/skynetservices/skydns)
  40. for details.