I am using the official Python Kubernetes client to create Pods dynamically:
kube_api.create_namespaced_pod(body=pod_spec, namespace='default')
However it looks like Kubernetes tries to pull the image assuming my local registry is using v1
:
Failed to pull image "localhost:5000/foo:bar": rpc error: code = Unknown desc = Error while pulling image: Get http://localhost:5000/v1/repositories/foo/images: dial tcp 127.0.0.1:5000: getsockopt: connection refused
This doesn't work, as my local registry is using v2
and apparently it is not backward compatible.
To fix this I see two solutions:
Changing Kubernetes' (or Docker's?) config to change the API to v2. I've been searching a lot but can't find how to do that.
Creating a
v1
registry. But I couldn't find any docker image for it, and this sounds like a bad solution asv1
is deprecated.
PodSpec
intokubectl
; do you still get that same behavior? And, of course, does yourimage:
field actually saylocalhost:5000/
followed by the name and tag? – mdaniel