Costs
Nebius AI Cloud charges you only for running a Managed Kubernetes cluster. For more details, see the Managed Kubernetes pricing.Prerequisites
- Create a Managed Service for Kubernetes cluster if you have not done it before.
- Install kubectl and connect to the cluster.
Steps
Prepare manifests for NodeLocal DNSCache and local redirect policy
-
Retrieve the service IP address for
coredns: -
Create a manifest file named
node-local-dns.yaml. In theDaemonSetspecification (spec.template.spec.containers.args), replace the coredns_IP_address with the IP address of thecorednsservice you obtained in the previous step.This manifest declares a DaemonSet for NodeLocal DNSCache and a service account, service and ConfigMap needed for its operation.node-local-dns.yaml
-
Create a manifest file named
node-local-dns-lrp.yaml.This manifest declares a local redirect policy that directs DNS requests at thenode-local-dns-lrp.yaml
node-local-dnsDaemonSet for resolution.
Apply the manifests and create resources
-
Create resources for NodeLocal DNSCache:
-
Create the local redirect policy:
Test NodeLocal DNSCache
Create a test environment
-
Create a manifest file named
dnsutils.yaml.dnsutils.yaml
-
Launch the
dnsutilspod: -
Find out which node is running the
dnsutilspod:The result looks like the following:Once the pod status isRunning, get the ID of the node from theNODEcolumn. -
Use the ID of the node to find out the IP address of the pod that runs NodeLocal DNSCache on this node:
Run tests
-
Get the values of the metrics for DNS requests before testing:
The result looks like the following:
-
Run several DNS requests:
-
Now check the metrics again:
The values of the metrics should increase, for example:If the tests don’t show the expected metrics increase, there may be an error in your configuration.
Troubleshoot issues and inspect logs
-
Check that the local redirect policy is enabled in the Cilium configuration:
The expected result is:
-
Check that the
node-local-dnslocal redirect policy declared earlier is properly applied:The expected result is something like the following: -
Check the local redirect policy rules on any of the Cilium pods:
-
Get the list of Cilium pods:
-
Get the local redirect policy rules on one of these pods:
The expected result is something like the following:
-
Get the list of Cilium pods:
-
Check the contents of the
resolv.conffile in thednsutilspod:The expected result is something like the following: -
Check DNS logs.
To enable logs for pods running DNS services, create a custom ConfigMap
coredns-custom.yamlthat contains alog.overridekey:Apply the custom ConfigMap:To enable logs for thenode-local-dnsservice, edit the ConfigMap:Add thelogconfig parameter within theCorefilesection:Now you can get the logs of the pods running DNS services:
Delete testing resources
Delete thednsutils pod:
How to disable NodeLocal DNSCache
If you no longer want to use NodeLocal DNSCache in your cluster, you can disable it:-
Delete the local redirect policy:
-
Delete the resources you created for NodeLocal DNSCache: