I have been reading a lot of posts about this but according to them I should have my bases covered so I am not sure what is going on.
I am using Minikube, Docker, Helm, and a local Docker registry on a Mac. After I install with Helm I see the following error.
Failed to pull image "127.0.0.1:5000/hello-world:v1.0": rpc error: code = Unknown desc = Error response from daemon: manifest for 127.0.0.1:5000/hello-world:v1.0 not found: manifest unknown: manifest unknown
My deployment spec looks like this.
spec:
containers:
- name: hello-world
image: 127.0.0.1:5000/hello-world:v1.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5000
protocol: TCP
I get this if I try to pull the image.
$docker pull 127.0.0.1:5000/hello-world:v1.0
v1.0: Pulling from hello-world
Digest: sha256:0534fcc8d406574f7def33e726f0e476ce94866e21d8cbd6ed4c273de113e9d3
Status: Image is up to date for 127.0.0.1:5000/hello-world:v1.0
127.0.0.1:5000/hello-world:v1.0
Then I check the manifest and it exists.
$curl -X GET 127.0.0.1:5000/v2/hello-world/manifests/sha256:0534fcc8d406574f7def33e726f0e476ce94866e21d8cbd6ed4c273de113e9d3
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2 json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1 json",
"size": 8102,
"digest": "sha256:49188cd9fa7002b28391f01ba5c0ce4328cc467abeb6743d181cbe1a3a2fd37c"
},
...
}
Any help will be greatly appreciated
Edit:
The exact commands I executed are as follows
- docker run -d -p 5000:5000 --restart=always --name registry registry:2
- docker build . -t hello-world:v1.0
- docker tag hello-world:v1.0 127.0.0.1:5000/hello-world:v1.0
- docker push 127.0.0.1:5000/hello-world:v1.0
- helm install hello-world ./hello-world
Edit With Resolution:
I finally got it to work. I had to modify the image key in the podspec of the pod/deployment manifest to host.minikube.internal:5000/hello-world:v1.0
as suggested in the thread with @zsolt. Secondly I had to start minikube with --insecure-registry="host.minikube.internal:5000"
instead of --insecure-registry="127.0.0.1:5000"
while executing minikube delete
before this change. Thanks for the assistance @zsolt!
CodePudding user response:
You can enable registry addon in minikube:
minikube addons enable registry
Also you can enable alias for registry:
minikube addons enable registry-aliases # test.com, test.org, example.com, example.org
Docs: https://github.com/kubernetes/minikube/blob/master/deploy/addons/registry-aliases/README.md
UPDATE:
I just reread you question, you want to reach from minikube the registry that is running on your host machine. For that you can use the host.minikube.internal
hostname, so host.minikube.internal:5000/hello-world:v1.0
Docs: https://minikube.sigs.k8s.io/docs/handbook/host-access/