Skip to content

K8S DNSConfig not apply to the pod #612

@mysiki

Description

@mysiki

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew and needs attention

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions