'k3d tries to pull Docker image instead of using the local one
Just study the core of K8S on local machine (Linux Mint 20.2).
Created one node cluster locally with:
k3d cluster create mycluster
And now I want to run spring boot application in a container.
I build local image:
library:0.1.0
And here is snippet from Deployment.yml
:
spec:
terminationGracePeriodSeconds: 40
containers:
- name: 'library'
image: library:0.1.0
imagePullPolicy: IfNotPresent
Despite the fact that image is already built:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
library 0.1.0 254c13416f46 About an hour ago 462MB
Starting the container fails:
pod/library-867dfb64db-vndtj Pulling image "library:0.1.0"
pod/library-867dfb64db-vndtj Failed to pull image "library:0.1.0": rpc error: code = Unknown desc = failed to pull and unpack image "library:0.1.0": failed to resolve reference "library:0.1.0": failed to do request: Head "https://...com/v2/library/manifests/0.1.0": x509: certificate signed by unknown authority
pod/library-867dfb64db-vndtj Error: ErrImagePull
pod/library-867dfb64db-vndtj Error: ImagePullBackOff
pod/library-867dfb64db-vndtj Back-off pulling image "library:0.1.0"
How to resolve local images visibility for k3d cluster?
Solution:
Update the Deployment.yml
:
spec:
terminationGracePeriodSeconds: 40
containers:
- name: 'library-xp'
image: xpinjection/library:0.1.0
imagePullPolicy: Never
And import the image to cluster:
k3d image import xpinjection/library:0.1.0 -c mycluster
Solution 1:[1]
If you don't want to use a docker registry, you have to import the locally built image into the k3d cluster:
k3d image import [IMAGE | ARCHIVE [IMAGE | ARCHIVE...]] [flags]
But don't forget to configure in your deployment:
imagePullPolicy: Never
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | bguess |