Configure authentication for Git and Docker registries in Tekton Pipelines
Tekton supports authentication for Git repositories and Docker registries using Kubernetes Secrets. This guide shows you how to configure authentication for your TaskRuns and PipelineRuns.
Tekton supports authentication via Kubernetes first-class Secret types:
Git: kubernetes.io/basic-auth and kubernetes.io/ssh-auth
Docker: kubernetes.io/basic-auth, kubernetes.io/dockercfg, and kubernetes.io/dockerconfigjson
A TaskRun or PipelineRun gains access to these Secrets through its associated ServiceAccount. Tekton converts properly annotated Secrets and stores them in a Step’s container as:
Git: ~/.gitconfig file or ~/.ssh directory
Docker: ~/.docker/config.json file
Tekton performs credential initialization within every Pod before executing any Steps, accessing each Secret and aggregating them into /tekton/creds before copying or symlinking files to the user’s $HOME directory.
You must annotate each Secret to specify the domains for which Tekton can use the credentials. Tekton ignores all Secrets that are not properly annotated.A credential annotation key must begin with tekton.dev/git- or tekton.dev/docker- and its value is the URL of the host:
GitHub deprecated basic authentication with username and password. Use a personal access token instead of a cleartext password. See GitHub’s documentation.
If you specify both Tekton basic-auth and Kubernetes dockerconfigjson Secrets, Tekton merges all credentials but basic-auth overrides the Kubernetes Secrets.
This warning can occur for several reasons:Multiple Steps with varying UIDsSteps with different users/UIDs trying to initialize credentials in the same Task. Solution: Ensure all Steps run with the same UID using a TaskRun’s Pod template field.Workspace or Volume also mountedA Task has both a Workspace/Volume for credentials and a ServiceAccount with credentials. Solution: Don’t mix credentials mounted via Workspace with those initialized via ServiceAccount.Read-only Workspace for $HOMEA Task has a read-only Workspace mounted for the HOME directory. Solution: Don’t mix credentials mounted via Workspace with ServiceAccount-based initialization.Step named image-digest-exporterIf this warning appears for the image-digest-exporter Step, you can safely ignore it. This Step is injected by Tekton and doesn’t use the credentials.