Windows-Containers icon indicating copy to clipboard operation
Windows-Containers copied to clipboard

K8S DNSConfig not apply to the pod

Open mysiki opened this issue 4 months ago • 3 comments

Describe the bug When we deploy a windows container with DNSConfig parameter, this parameter is not apply to the container.

To Reproduce

  • Deploy custom coreDNS pod
  • Deploy Pod with DNSconfig which point to this coreDNS service

Expected behavior POD DNS should be setup with the information which come from DNSConfig

Configuration:

  • Edition: Windows Server]
  • Base Image being used: tested on Windows Server Core 2022 and Windows server nano 2022
  • Container engine: K8S - ctr
  • Container Engine version K8S (on EKS) 1.30

Additional context

The same dnsConfig setting work normally on Linux pod.

Pod manifest

---
apiVersion: v1
kind: Pod
metadata:
  name: powershell-debug
spec:
  containers:
  - name: powershell
    # image: mcr.microsoft.com/powershell:lts-7.2-nanoserver-ltsc2022
    image: mcr.microsoft.com/windows/servercore:ltsc2022
    # command: ["pwsh"]
    command: ["powershell.exe"]
    args: ["-c", "ping", "-t", "localhost"]
  dnsConfig:
    nameservers:
    - 172.20.159.24
    options:
    - name: ndots
      value: "5"
    searches:
    - svc.cluster.local
    - cluster.local
  dnsPolicy: None
  nodeSelector:
    kubernetes.io/os: windows
    kubernetes.io/arch: amd64
  tolerations:
    - effect: NoSchedule
      key: os
      operator: Equal
      value: windows
    - effect: NoExecute
      key: os
      operator: Equal
      value: windows

From the pod :

PS C:\> Get-DnsClientServerAddress

InterfaceAlias               Interface Address ServerAddresses
                             Index     Family
--------------               --------- ------- ---------------
vEthernet (cid-b20de771-e...        39 IPv4    {172.20.0.10}    <== Default corsDNS, not the custom one define into the config
vEthernet (cid-b20de771-e...        39 IPv6    {}
Loopback Pseudo-Interface 6         38 IPv4    {}
Loopback Pseudo-Interface 6         38 IPv6    {}

Resolve-DnsName -name svcname.svc.cluster.local
Resolve-DnsName : svcname.svc.cluster.local : DNS name does not exist
At line:1 char:1
+ Resolve-DnsName -name svcname.svc.c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (svcname...c.cluster.local:String) [Resolve-DnsName], Win32Exception
    + FullyQualifiedErrorId : DNS_ERROR_RCODE_NAME_ERROR,Microsoft.DnsClient.Commands.ResolveDnsName
Resolve-DnsName -name svcname.svc.cluster.local -Server 172.20.159.24

Name                                           Type   TTL   Section    IPAddress
----                                           ----   ---   -------    ---------
svcname.svc. A      5     Answer     172.20.111.200
cluster.local

mysiki avatar Sep 06 '25 22:09 mysiki

Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.

github-actions[bot] avatar Sep 06 '25 22:09 github-actions[bot]

This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.

This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.

This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.