Sub topic 5
Logging in to a registry
This chapter covers authenticating with helm registry login. It assumes you have Helm 3.8 or later, know how docker login works, and have a chart packaged as a .tgz file. The next chapter uses the session you create here to push that chart.
What login does
Most registries require credentials for pushing. Many also require them for pulling private charts. Helm sends your credentials to the registry and, if the registry accepts them, saves them locally. Later commands such as helm push, helm pull, and helm install read the saved credentials automatically.
Helm has no separate token system for this. It reuses the registry's own authentication, so whatever works with docker login on your registry works here too.
Logging in interactively
Pass the registry host name, and Helm prompts for a password if you don't supply one:
helm registry login registry.example.com --username alice
# Password:
# Login SucceededUse only the host, and the port if there is one. Do not include oci:// or a repository path such as /charts. The path belongs in push and pull commands, not in login.
Logging in without a prompt
Scripts and CI jobs cannot type a password. Use --password-stdin and pipe the secret in:
echo "$REGISTRY_TOKEN" | helm registry login registry.example.com \
--username alice --password-stdinPrefer this over --password. A value passed with --password appears in your shell history and in the process list, where other users on the machine can read it.
Many registries expect an access token instead of your account password. Examples are a personal access token on GitHub Container Registry or a service account key on a cloud provider. Some, such as Amazon ECR, issue short-lived passwords that you must regenerate. Check your registry's documentation for the username to use with a token.
Where credentials are stored
Helm writes credentials to a registry config file. On Linux the default is ~/.config/helm/registry/config.json, and the location differs on other operating systems. You can choose a different file with the --registry-config flag or the HELM_REGISTRY_CONFIG environment variable.
The file uses the same JSON layout as Docker's config.json, so it can delegate to a credential helper instead of holding the secret itself. Using a helper from your operating system keeps passwords out of plain text. Without one, the credentials are stored base64-encoded, which is not encryption.
In CI, set HELM_REGISTRY_CONFIG to a temporary path. The credentials then stay inside that job and do not touch a shared configuration.
Options for private or self-hosted registries
A registry with a private certificate authority or a self-signed certificate needs extra flags:
| Flag | Purpose |
|---|---|
| `--ca-file` | Trust a custom certificate authority |
| `--cert-file` and `--key-file` | Present a client certificate |
| `--insecure` | Skip TLS certificate verification |
| `--plain-http` | Use HTTP instead of HTTPS (newer Helm versions) |
Logging out
To remove the saved credentials for a registry:
helm registry logout registry.example.comDo this on shared machines and at the end of CI jobs that did not use a temporary config file.
Common login problems
unauthorizedor401: The username, password, or token is wrong, expired, or lacks permission for the action. A login can succeed and a later push can still fail if the token has read access only.x509: certificate signed by unknown authority: The registry uses a certificate your system doesn't trust. Pass--ca-file.- Login succeeds but pull still fails: Check that you logged in to the same host name you use in the
oci://reference.registry.example.comandregistry.example.com:5000are different hosts.
Exercise
A CI job runs helm registry login registry.example.com --username ci-bot --password "$TOKEN". Give two reasons this is a poor choice and show a better command.
Show answer
The --password flag exposes the token in the process list and can leak into logs or shell history. Better: echo "$TOKEN" | helm registry login registry.example.com --username ci-bot --password-stdin. For extra isolation, also set HELM_REGISTRY_CONFIG to a temporary file so the saved credentials do not outlive the job.