microsoft / microsoft/Windows-Containers

K8S DNSConfig not apply to the pod

Open
#612 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
PowerShell
Stars
551
Forks
76
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Windows pod manifest and compare its dnsConfig behavior with the stated Linux behavior. Reproduce the issue using Get-DnsClientServerAddress and Resolve-DnsName, then verify that the configured nameserver and search domains are applied and cluster service resolution succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, powershell
Domain
devops, networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.