0

I built a docker image on local. Its name is myapp.

Deploy it as myjob.yaml:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: myapp
spec:
  schedule: "*/2 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: myapp
              image: myapp

Use kind as a local k8s cluster environment. Load this image:

kind load docker-image myapp

Deploy app:

kubectl apply -f myjob.yaml

Confirm the pods' log, it can find the image myapp.

Is it necessary to create a container register on local to serve images?

Andrzej Sydor
  • 1,373
  • 4
  • 13
  • 28
oiio
  • 45
  • 1
  • 7
  • 2
    What's the error you're getting? There's [a note in the kind documentation](https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster) that specifying `image: myapp` with an implicit `...:latest` tag will cause the cluster to try to pull the image again, so you either need a per-build tag (preferred) or to explicitly specify `imagePullPolicy: Never`. – David Maze Feb 20 '21 at 15:58
  • @DavidMaze You are right. Can you write it as an answer? – oiio Feb 22 '21 at 01:46

1 Answers1

0

Providing an answer based on @David Maze comment.

There's a note in the kind documentation that specifying image: myapp with an implicit ...:latest tag will cause the cluster to try to pull the image again, so you either need a per-build tag (preferred) or to explicitly specify imagePullPolicy: Never

enter image description here

Vit
  • 7,740
  • 15
  • 40