#6169·coredns

Kubernetes plugin cache is not deleting "succeeded" pods

Author: dannycheung-roktCreated Jun 19, 2023Updated Sep 30, 2026
Labelsbug

What happened:

  1. In NamespaceA, PodA is spawned.
  2. kubernetes plugin sees the pod and caches the IP.
  3. PodA completes and has a phase of "Succeeded". The IP is released back to k8s.
  4. In NamespaceB, PodB is spawned. It is assigned the IP previously held by PodA.
  5. CoreDNS logs show the kubernetes/client-namespace metadata is NamespaceA

What you expected to happen:

CoreDNS logs show the kubernetes/client-namespace metadata is NamespaceB

How to reproduce it (as minimally and precisely as possible):

Difficult to reliably recreate as it requires IP addresses to re-assigned/re-used.

Anything else we need to know?:

Environment:

  • the version of CoreDNS: v1.8.7
  • Corefile:
    .:53 {
        errors
        health
        metadata
        log . "{remote}:{port} - {>id} \"{type} {class} {name} {proto} {size} {>do} {>bufsize}\" {rcode} {>rflags} {rsize} {duration} {/kubernetes/client-namespace} {/kubernetes/client-pod-name} {/kubernetes/parse-error}"
        autopath @kubernetes
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods verified
          fallthrough in-addr.arpa ip6.arpa
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
        template ANY AAAA {
          rcode NOERROR
        }
    }
  • logs, if applicable:
  • OS (e.g: cat /etc/os-release):
  • Others: