Issues Pulling Images
This document provides steps to resolve "401 Unauthorized" errors when pulling images from Harness Artifact Registry.
Understanding 401 Errors When Pulling Images
401 Unauthorized errors occur when Harness Artifact Registry fails to authenticate image pull requests from the Kubernetes cluster.
Ensure your cluster has the correct imagePullSecrets
and Kubernetes secrets configured.
Example Solution
To authenticate your Kubernetes cluster, follow these steps:
-
Create a Docker Registry Secret:
kubectl create secret docker-registry docker-registry-secret1 \
--docker-server=pkg.harness.io \
--docker-username=<email> \
--docker-password=<personal-access-token> \
--docker-email=<email> \
--namespace=default -
Update your Kubernetes deployment manifest to reference the secret:
apiVersion: v1
kind: Pod
metadata:
name: your-pod-name
namespace: default
spec:
containers:
- name: your-container-name
image: pkg.harness.io/your-image:tag
imagePullSecrets:
- name: docker-registry-secret1
- Verify the Setup:
Deploy the updated manifest and monitor the pod status to ensure the image is pulled successfully without authentication errors.
Kubernetes-specific guides
Go to the Private Registry for Kubernetes guide or Add Container Images as Artifacts for more details on how to pull an image from a private registry, or to add container images as artifacts for Kubernetes deployments.