Deploying a manifest in Docker Desktop (v4.21.1) Kubernetes cluster.
The image used in manifest looks like below,
my-local.artifactory.com/docker-images/my-app:v1.0.0
The secret with docker config is created and referred within the manifest in imagePullSecrets
. The imagePullPolicy
is set to Always
.
Error message
Failed to pull image "my-local.artifactory.com/docker-images/my-app:v1.0.0": rpc error: code = Unknown desc = Error response from daemon: Head "https://my-local.artifactory.com/v2/docker-images/my-app/manifests/v1.0.0": unknown: Authentication is required
The deployment failed since not able to pull image and indicates Authentication required. Odd thing is that the kubelet docker-desktop
used the URL that looks like – https://my-local.artifactory.com/v2/myapp/manifests/v1.0.0
But not sure how this URL is constructed.
- Question:
How Docker desktop kubelet know to create this urlhttps://my-local.artifactory.com/v2/myapp/manifests/v1.0.0
? Not sure howv2
is added to the URL.
When hit the URL directly in browser, do get below message.
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
2
Answers
The URL is specified by the Docker Registry HTTP API V2.
The image name
my-local.artifactory.com/docker-images/my-app:v1.0.0
breaks down into three parts: the registry namemy-local-artifactory.com
, the image namedocker-images/my-app
, and the tagv1.0.0
. To pull the image, the kubelet (or anything else) first needs to fetch a piece called the image manifest, and that manifest has a list of the individual layers that need to be downloaded.The registry API specifies the manifest URL as
where
GET
is an HTTP verb,<name>
is the image name, and<reference>
is either the tag or a digest hash. This matches the URL in the error message.As Chris mentioned, v2 in the URL represents the api version.
From your description we know that you are using an artifact registry for storing your images.
The error describes that it requires authentication to access this image/artifact
As per this article in County: