Kubebuilder: controller failed because it can't pull controller:latest

Created on 21 Jul 2019  路  6Comments  路  Source: kubernetes-sigs/kubebuilder

After make docker-build on Mac, I got two files:

  • config/default/manager_image_patch.yaml-e: <== The file name is appended with -e
apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
spec:
  template:
    spec:
      containers:
      # Change the value of image field below to your controller image URL
      - image: IMAGE_URL
        name: manager
  • config/default/manager_image_patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
spec:
  template:
    spec:
      containers:
      # Change the value of image field below to your controller image URL
      - image: IMAGE_URL
        name: manager
xiabins-MacBook-Pro:test xiabin$ cat config/default/manager_image_patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
spec:
  template:
    spec:
      containers:
      # Change the value of image field below to your controller image URL
      - image: controller:latest
        name: manager

I believe this behavior is not expect. Can you please confirm it?

Then I load the image to kind with kind load docker-image controller:latest and run make deploy.

The controller failed with the error:

  Normal   Pulling      22s (x2 over 37s)  kubelet, kind-control-plane  Pulling image "controller:latest"
  Warning  Failed       21s (x2 over 33s)  kubelet, kind-control-plane  Failed to pull image "controller:latest": rpc error: code = Unknown desc = failed to resolve image "docker.io/library/controller:latest": no available registry endpoint: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
  Warning  Failed       21s (x2 over 33s)  kubelet, kind-control-plane  Error: ErrImagePull
  Normal   BackOff      6s (x2 over 33s)   kubelet, kind-control-plane  Back-off pulling image "controller:latest"
  Warning  Failed       6s (x2 over 33s)   kubelet, kind-control-plane  Error: ImagePullBackOff

My guess is that the image in manager_image_patch.yaml is incorrect. But I don't know how to specify the correct one. Could you please help?

kinbug

All 6 comments

I discussed with @mengqiy and he pointed out that using :latest tag, kubelet (in kind cluster) will ignore the cache and reach out to registry and will fail. Can you try specifying the tag other than latest in makefile and retry this ?

@bingosummer Can you share output of kubebuilder version command and also bash --version command to debug the issue with manager_image_patch.yaml file you reported above.

@droot

$ kubebuilder version
Version: version.Version{KubeBuilderVersion:"2.0.0-beta.0", KubernetesVendor:"1.14.1", GitCommit:"b12371ccabd1bc8de7ec7ec1a1ca7bfabe567701", BuildDate:"2019-07-19T19:02:15Z", GoOs:"unknown", GoArch:"unknown"}
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.

@droot @mengqiy
After specifying the tag other than latest, it still doesn't work.

Failed to pull image "controller:v0.0.1": rpc error: code = Unknown desc = failed to resolve image "docker.io/library/controller:v0.0.1": no available registry endpoint: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

You need to load the image to your kind cluster by running kind load docker-image controller:v0.0.1.
And also ensure your deployment spec is not using imagePullPolicy: Always.
Ref: https://book.kubebuilder.io/cronjob-tutorial/running-webhook.html#build-your-image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Adirio picture Adirio  路  6Comments

cheyang picture cheyang  路  4Comments

kuroneko25 picture kuroneko25  路  3Comments

jsarkar picture jsarkar  路  6Comments

champak picture champak  路  4Comments