Helm Find Repository URL For a Release
Let’s say I have this release called mongodb
in mongo
Kubernetes namespace:
$ helm list -n mongo
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mongodb mongo 2 2023-03-23 deployed mongodb-sharded-5.0.17 5.0.9
For this release (mongodb
), if I want to find out which repository (URL) the mongodb-sharded-5.0.17
chart came from then one way is to figure out the environment from which the helm chart was installed and run helm search repo
there:
# NAME is shown as repo/chart-name
$ helm search repo mongodb-sharded --version 5.0.17
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/mongodb-sharded 5.0.17 5.0.9 MongoDB(R) is an open source NoSQL database tha...
$ helm repo list | grep bitnami
bitnami https://charts.bitnami.com/bitnami
But in some cases, we may not have access to the environment (above) or not even know where it is. Or as a cluster admin, I may want to find out the repository information (name and URL) for a release purely by querying the K8S cluster (via helm
). Since Helm stores release data in K8S Secrets, one might think this would be possible, but currently, it’s not. There’s an HIP to have this information available, so we can expect this to happen in the future.
The idea behind why this wasn’t initially implemented was because a Helm chart is not tied to a particular repository or a location per se. We can copy a chart from anywhere and install that locally. But I still think it would be useful to have this information available and hope that the HIP goes through.
Till then, we can try to get the chart metadata of the release (which comes from Chart.yaml
) and see if the repository name and URL can be reverse-engineered from there. This information can be found in K8S secrets:
$ k get secret -n mongo
NAME TYPE DATA AGE
sh.helm.release.v1.mongodb.v1 helm.sh/release.v1 1 10d
sh.helm.release.v1.mongodb.v2 helm.sh/release.v1 1 5d
# We pick the latest release secret from above
$ k get secret sh.helm.release.v1.mongodb.v2 -n mongo -o yaml | \
yq .data.release | \
tr -d '"' | \
base64 -d | \
base64 -d | \
gzip -d | \
jq .chart.metadata
{
"name": "mongodb-sharded",
"home": "https://github.com/bitnami/charts/tree/master/bitnami/mongodb-sharded",
"sources": [
"https://github.com/bitnami/bitnami-docker-mongodb-sharded",
"https://mongodb.org"
],
"version": "5.0.17",
"description": "MongoDB(R) is an open source NoSQL database that uses JSON for data storage. MongoDB(TM) Sharded improves scalability and reliability for large datasets by distributing data across multiple machines.",
"keywords": [
"mongodb",
"database",
"nosql",
"cluster",
"replicaset",
"replication"
],
"maintainers": [
{
"name": "Bitnami",
"url": "https://github.com/bitnami/charts"
}
],
"icon": "https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png",
"apiVersion": "v2",
"appVersion": "5.0.9",
"annotations": {
"category": "Database"
},
"dependencies": [
{
"name": "common",
"version": "1.x.x",
"repository": "https://charts.bitnami.com/bitnami",
"tags": [
"bitnami-common"
],
"enabled": true
}
]
}
The name
, version
, maintainers
and maybe some other fields can help us understand the chart name and the creator/maintainer of that. If the chart is public, we can use these details to Google or search on Artifact Hub to find the repository information.