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

Error in K8S ipv6 addresses validation CommonUtilization.valid_chars() / VALID_CHARS_RE #1001

Open
akaRem opened this issue Dec 11, 2023 · 2 comments
Labels

Comments

@akaRem
Copy link

akaRem commented Dec 11, 2023

Description
When running in K8S with ipv6 addresses, client fails with error like Invalid "kubernetes" data ("kubernetes_service_host"): "fd95:b6e3:daad::1"

Expected Behavior
Agent should accept ipv6 addresses

Troubleshooting or NR Diag results
After looking at code and at environment, I found that K8S injects the following variables:

...
KUBERNETES_SERVICE_HOST=fd95:b6e3:daad::1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=fd95:b6e3:daad::1
...

The error happens in KubernetesUtilization class in detection process:
Detection https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L153-L157 consist of fetching the data (reading envvar KUBERNETES_SERVICE_HOST) then validating it for correctness, one of the steps https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L127 is checking valid chars https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L27 , the agent does not expect : and fails

Steps to Reproduce
Run in K8S with ipv6

Your Environment
EKS with ipv6

Additional context

@Nimja
Copy link

Nimja commented Dec 11, 2023

As a temporary solution, you can override the ENV variable in K8S pod configs, which works, with a hostname instead of the assigned IP.

@TimPansino
Copy link
Contributor

I'll forward this along to the architecture group and we'll get all the agents updated to support ipv6 for K8s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants