k6-operator icon indicating copy to clipboard operation
k6-operator copied to clipboard

Starter doesn’t work in an IPv6 cluster

Open yann-soubeyrand opened this issue 2 years ago • 4 comments

Brief summary

In an IPv6 cluster, the starter pod logs this error:

curl: (3) IPv6 numerical address used in URL without brackets

k6-operator version or image

latest

K6 YAML

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: load-test
  namespace: load-testing
spec:
  parallelism: 100
  script:
    configMap:
      name: load-test
      file: load-test.js
  separate: true
  runner:
    resources:
      requests:
        cpu: 1
        memory: 4G

Other environment details (if applicable)

No response

Steps to reproduce the problem

Create an IPv6 cluster on AWS EKS, deploy the operator inside and start a test.

Expected behaviour

The test run as expected.

Actual behaviour

The test doesn’t start because the operator doesn’t seem to handle IPv6.

yann-soubeyrand avatar Dec 05 '22 19:12 yann-soubeyrand

Looks like it's a rather well-known issue for IPv6 in general and specifically for curl.

At first glance, seems like a quick fix with adding brackets to curl command. But curl doesn't seem to support brackets with IPv4 so we'll need to check first if it's IPv4 or IPv6; maybe before Job creation, in https://github.com/grafana/k6-operator/blob/5cec748534424741fbea0e1875218b56bf5af670/controllers/k6_start.go#L71-L80

Either way, thanks for opening this, @yann-soubeyrand!

yorugac avatar Dec 14 '22 13:12 yorugac

I have the same issue as described earlier i.e. I try to start a test on an ipv6-only EKS-cluster, but the k6-sample-starter-pod fails to start due to following error:

curl: (3) IPv6 numerical address used in URL without brackets

For now I was able to go around this issue by creating a custom-image by using following line:

parts = append(parts, fmt.Sprintf("curl -g --retry 3 -X PATCH -H 'Content-Type: application/json' http://[%s]:6565/v1/status -d '%s'", hostname, req)) in NewStartContainer and NewStopContainer-function (please note that I needed to provide also this -g globbing option)

If there is away to do this globally i.e. supporting both ipv4 and ipv6, I would be more than happy to try that out :)

pasi-romo-idealo avatar Sep 27 '23 13:09 pasi-romo-idealo

Let’s go ahead 🙆

kahirokunn avatar Jun 07 '24 22:06 kahirokunn

@pasi-romo-idealo

If there is away to do this globally i.e. supporting both ipv4 and ipv6, I would be more than happy to try that out :)

I tested it by adding net package and then using net.JoinHostPort(), which wraps the hostname in square braces if it's a literal IPv6 address.

parts = append(parts, fmt.Sprintf("curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://%s/v1/status -d '%s'", net.JoinHostPort(hostname, "6565"), req)) I tested it on my local and it supports both IPv4 and IPv6.

zzhao2010 avatar Aug 07 '24 19:08 zzhao2010