# K6-operator issue with ipv6

**URL:** <https://community.grafana.com/t/k6-operator-issue-with-ipv6/127880>\
**Category:** k6-operator\
**Created:** [August 5, 2024, 8:22pm UTC](https://community.grafana.com/t/k6-operator-issue-with-ipv6/127880 "2024-08-05T20:22:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zzhao2022](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zzhao2022](https://community.grafana.com/u/zzhao2022)\
**Post date:** [August 5, 2024, 8:22pm UTC](https://community.grafana.com/t/k6-operator-issue-with-ipv6/127880/1 "2024-08-05T20:22:13Z")

</div>

Hi,  
I am testing the k6-operator using EKS on AWS. I was following the official [instruction](https://grafana.com/docs/k6/latest/testing-guides/running-distributed-tests/#2-create-a-test-script.). However the executor pod kept failing apart due to the issue with ipv6. Does k6-operator support ipv6?

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/0/f/0f89b1bd2aba5fefb3b65da1d54951df07a902b4.png)  
The error msg shows " curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535" in the pod.

I see the curl command uses ipv6 when I describe the pod. I think this is the root cause of the pod failure.

```auto
curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://fdfe:d15b:965c::905a:6565/v1/status -d '{"data":{"attributes":{"paused":false,"stopped ││ ":false},"id":"default","type":"status"}}'

```

Below is my conf.yaml file

```yaml
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
  name: run-k6-with-realtime
spec:
  parallelism: 1
  # cleanup: post
  arguments: -o experimental-prometheus-rw --tag testid=test
  script:
    configMap:
      name: my-test
      file: test.js
  runner:
    env:
      - name: K6_PROMETHEUS_RW_SERVER_URL
        value: "http://prometheus-kube-prometheus-prometheus.monitor.svc.cluster.local:9090/api/v1/write"
      - name: K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM
        value: "true"

```

Looks like it’s a [known issue](https://github.com/grafana/k6-operator/issues/171) as the status of this issue is still “Open”. It’s been over 2 years since the issue was open. Wondering if there is any update or workaround.

---

<div class="post-metadata">

**Author:** ![zzhao2022](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zzhao2022](https://community.grafana.com/u/zzhao2022)\
**Post date:** [August 7, 2024, 7:43am UTC](https://community.grafana.com/t/k6-operator-issue-with-ipv6/127880/2 "2024-08-07T07:43:10Z")

</div>

btw, there was a workaround provided in the issue and it does work. However it only works with IPv6.

> 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)

I am looking for a solution that supports both IPv4 and IPv6. What I tried was to introduce the `net` package and then use `net.JoinHostPort` to wrap 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))`

The above change is made At [k6-operator/pkg/resources/containers/curl\_start.go at main · grafana/k6-operator · GitHub](https://github.com/grafana/k6-operator/blob/main/pkg/resources/containers/curl_start.go#L29) and [k6-operator/pkg/resources/containers/curl\_stop.go at main · grafana/k6-operator · GitHub](https://github.com/grafana/k6-operator/blob/main/pkg/resources/containers/curl_stop.go#L29)

However it doesn’t seem to work when I tested it. The initializer pod stuck there.

---

<div class="post-metadata">

**Author:** ![zzhao2022](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zzhao2022](https://community.grafana.com/u/zzhao2022)\
**Post date:** [August 7, 2024, 9:57pm UTC](https://community.grafana.com/t/k6-operator-issue-with-ipv6/127880/4 "2024-08-07T21:57:45Z")

</div>

@vicentevincenzo Yes. I just made a [PR](https://github.com/grafana/k6-operator/pull/437) for my fix.
