kubernetes / cloud-provider-openstack

Apache License 2.0
599 stars 597 forks source link

[occm] doesn't rely on coredns configuration to do dns resolution #2592

Closed xinity closed 1 month ago

xinity commented 1 month ago

/kind bug

What happened: using occm daemonset on a cluster where coredns has a specific domain resolution for internal services (openstack core services). the dns resolution made by occm seem to not rely on coredns configuration.

What you expected to happen: the dns resolution done by occm should use the coredns configuration and resolve internal services rather than trying to resolv on the public internet.

How to reproduce it: add into coredns configmap a specific domain resolution configuration:

[MYDOMAIN]:53 {
   log
   errors
   ready
   cache 10
   forward . [DNS1] [DNS2]
}

reload coredns configuration test the resolution with the occm pod

Anything else we need to know?: i've use the documentation https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/ to debug dns resolution. the conclusion is everything is configured correctly.

Environment:

dulek commented 1 month ago

This seems to be similar to https://github.com/kubernetes/cloud-provider-openstack/issues/2574, OCCM doesn't specify dnsPolicy, so it defaults to ClusterFirst, but because OCCM runs with hostNetworking: true we end up with Default which means using DNS of the node. We should allow overriding this and default to ClusterFirstWithHostNet.