Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sepauli opened this issue Jun 3, 2024 · 0 comments · Fixed by #106
Closed

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

sepauli opened this issue Jun 3, 2024 · 0 comments · Fixed by #106

Comments

@sepauli
Copy link
Contributor

sepauli commented Jun 3, 2024

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

@mergify mergify bot closed this as completed in #106 Oct 24, 2024
mergify bot added a commit that referenced this issue Oct 24, 2024
## Description

the tink-stack pod crashes on an ipv6 only cluster because the container can not handle IPv6 addresses
```
:~# 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
```

## Why is this needed

We use an IPv6 only RKE2 Cluster and we need to start this container correctly.

Fixes: #99

## How Has This Been Tested?
I tested the fix in our RKE2 IPv6 only cluster and it works. But i don't have an IPv4 environment for testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant