Skip to content

tink-stack nginx can't handle IPv6 adresses #99

Closed
@sepauli

Description

@sepauli

Description

We have an RKE2 cluster running in IPv6 only mode.
During the deployment via the helm chart the tink-stack pod does not start due to the following error message

:~# kubectl logs -n tink-system tink-stack-6bbc556dd-znd6j
Defaulted container "tink-stack" out of: tink-stack, dhcp-relay
++ awk '/nameserver/ {print $2}' /etc/resolv.conf
+ POD_NAMESERVER=fd05:0000:0000::a
+ envsubst '$POD_NAMESERVER'
+ exec nginx -g 'daemon off;'
2024/06/03 16:23:37 [emerg] 3210953#3210953: invalid port in resolver "fd05:0000:0000::a" in /etc/nginx/nginx.conf:13
nginx: [emerg] invalid port in resolver "fd05:0000:0000::a" in /etc/nginx/nginx.conf:13

The reason is that the following bash command cannot handle IPv6 addresses.

        args:
        - |
          POD_NAMESERVER=$(awk '/nameserver/ {print $2}' /etc/resolv.conf) \
            envsubst '$POD_NAMESERVER' \
            </tmp/nginx.conf.template \
            >/etc/nginx/nginx.conf
          exec nginx -g 'daemon off;'

I changed the command to the following one, which works for me

        - export POD_NAMESERVER=$(awk 'NR==2 {print $2}' /etc/resolv.conf);
          [[ $POD_NAMESERVER == *.* ]] || POD_NAMESERVER="[$POD_NAMESERVER]";
          envsubst '$POD_NAMESERVER' < /tmp/nginx.conf.template > /etc/nginx/nginx.conf;
          nginx -g 'daemon off;'

I can open a PR if you want

To Reproduce

Deploy an RKE2 Cluster in IPv6 only mode and try to deploy the helm-chart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions