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

Unable to use Private Image Registry with CRD

Open kneemaa opened this issue 3 years ago • 2 comments

Brief summary

Hello, I'm required to host our images in our local registry. I've tested with the public image and my setup runs with no issue, the problem is that I cannot find a way to have my Runner and Starter use my private Registry.

I'm running the Operator model and ran into this limitation with using a PVC and switched gears to making my own image with my custom modules already provided.

My issue is that I cannot get the Runner (and most likely Starter) pods to authenticate to my private registry. In K8 i would normally use the following but it fails since the field isn't defined in the CRD.

What I expect but does not work

runner:
    imagePullSecrets:
        - secretNameHere

How do I use private a Private Registry for my Runners/Starters?

k6 version

v0.0.7

OS

Linux

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. Load image in Private Registry
  2. Update K6 CRD to use private image
  3. add the expected imagePullSecrets: setting with a valid secret name
  4. Try to update K6 CRD to support authenticating to registry
  5. Apply and observe fail

Expected behaviour

CRD Resources can source Docker Images from Private Registries.

Actual behaviour

Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  22s                default-scheduler  Successfully assigned chaos/k6-apache-stress-4-dpsh8 to xxxxxxxxxxxx
  Normal   BackOff    20s (x2 over 21s)  kubelet            Back-off pulling image "my-domain.jfrog.io/my-k6-runner:latest"
  Warning  Failed     20s (x2 over 21s)  kubelet            Error: ImagePullBackOff
  Normal   Pulling    7s (x2 over 21s)   kubelet            Pulling image "my-domain.jfrog.io/my-k6-runner:latest"
  Warning  Failed     7s (x2 over 21s)   kubelet            Failed to pull image "my-domain.jfrog.io/my-k6-runner:latest": rpc error: code = Unknown desc = failed to pull and unpack image "my-domain.jfrog.io/my-k6-runner:latest": failed to resolve reference "my-domain.jfrog.io/my-k6-runner:latest": failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized
  Warning  Failed     7s (x2 over 21s)   kubelet            Error: ErrImagePull

kneemaa avatar Aug 09 '22 14:08 kneemaa

This issue was originally opened in the k6 repo, but it's about k6-operator, so I moved it to the https://github.com/grafana/k6-operator/ repo

na-- avatar Aug 09 '22 14:08 na--

Hi @kneemaa Thanks for the issue! This is not a bug though but a feature request: as you mentioned, at the moment our CRD just doesn't have imagePullSecrets. It'd definitely be a useful enhancement to have.

Regarding volumes: please see my answer in the forum thread.

yorugac avatar Aug 14 '22 18:08 yorugac