Prepare Registry Credential
This guide shows you how to create a registry credential Secret that help you run your Tekton Tasks and Pipelines.
TOC
Prerequisites
- kubectl installed and configured to access the cluster.
- Permissions to read and write Secrets.
Steps
You can use the following command to generate the registry credential Secret:
kubectl -n <target-namespace> create secret docker-registry <secret-name> \
--docker-username=<username> \
--docker-password=<password> \
--docker-server=<registry>
You can also create a Secret directly.
Replace server/username/password with your own values.
The auth
field is base64 encoded username:password
, you can use the following command to generate it:
echo -n "username:password" | base64
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
namespace: <target-namespace>
type: kubernetes.io/dockerconfigjson
stringData:
.dockerconfigjson: |
{
"auths": {
"registry.example.com": {
"username": "CI_USER",
"password": "CI_PASS",
"auth": "BASE64(user:pass)"
}
}
}