How to specify pull secret of initContainers

I’m using a Helm chart to deploy Weaviate, but I want to store images in a local cluster’s registry that is blocked from external access.

In the values.yaml file, I was able to specify a pull secret for the Weaviate image as follows, which works fine:

image:
registry: XXXXXXXXXXXXXXXXXXXXXXX
tag: 1.26.4
repo: weaviate
policy
pullPolicy: IfNotPresent
pullSecrets:
- XXX-secret

However, I’m having trouble specifying the pull secret for the initContainers. Even if I use the same syntax, it doesn’t work.

Could you please help me verify this?

imagePullSecrets apply to both initContainers as well as regular containers, they are defined outside of the container specification. So I would assume that you have some different problem in the end - how did you come to the conclusion that the pull secrets are not being used to pull the init container image?

The Weaviate image stored in the same registry can be successfully pulled, but when trying to pull Alpine as an init container, the following error occurs:

Events:
Type Reason Age From Message


Normal Scheduled 8m18s default-scheduler Successfully assigned weaviate/weaviate-0 to node1
Warning Failed 6m52s (x6 over 8m16s) kubelet Error: ImagePullBackOff
Normal Pulling 6m38s (x4 over 8m17s) kubelet Pulling image “my_registry_url/alpine:latest”
Warning Failed 6m37s (x4 over 8m17s) kubelet Failed to pull image “my_registry_url/alpine:latest”: rpc error: code = Unknown desc = failed to pull and unpack image “my_registry_url/alpine:latest”: failed to resolve reference “my_registry_url/alpine:latest”: failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized
Warning Failed 6m37s (x4 over 8m17s) kubelet Error: ErrImagePull
Normal BackOff 3m15s (x20 over 8m16s) kubelet Back-off pulling image “my_registry_url/alpine:latest”

Hm, a couple ideas:

Thank you for your response.
I was able to solve the problem thanks to you.

Thank you!