Skip to content

Fix NodeLocal DNS IPv6 address formatting (missing [] for host:port) in IPv6-only deployments #13158

@kanyahal06

Description

@kanyahal06

What would you like to be added

  • When deploying an IPv6-only Kubernetes cluster using Kubespray v2.29.1 with:

    ipv6_stack: true
    ipv4_stack: false
    

    in the k8s-cluster.yml

  • The nodelocaldns pods fail to start and continuously crash. On inspecting the logs, the issue is traced to incorrect IPv6 address formatting in the generated nodelocaldns ConfigMap.

  • In the template: "roles/kubernetes-apps/ansible/templates/nodelocaldns-config.yml.j2"

    IPv6 addresses are rendered without square brackets [] when used in IP:port format.
    Example (current behavior):
    fd00::10:53

    This is invalid for IPv6 when combined with ports and leads to parsing failures.
    Correct format should be:
    [fd00::10]:53

  • Update the nodelocaldns-config.yml.j2 template to conditionally wrap IPv6 addresses with square brackets when used with ports.

    {% if ipv6_stack and not ipv4_stack %}
    [{{ some_ip }}]:{{ port }}
    {% else %}
    {{ some_ip }}:{{ port }}
    {% endif %}
    

Why is this needed

  • nodelocaldns pods fail to start
  • Continuous crash loops observed
  • DNS resolution inside the cluster is impacted
  • Breaks functionality in IPv6-only clusters

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions