Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all the kubernetes resources related to a helm deployment or chart

I deployed a helm chart using helm install and after this I want to see if the pods/services/cms related to just this deployment have come up or failed. Is there a way to see this?

Using kubectl get pods and greping for the name works but it does not show the services and other resources that got deployed when this helm chart is deployed.

like image 603
D. Rao Avatar asked Oct 12 '20 21:10

D. Rao


People also ask

What are Helm charts Kubernetes?

Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on.

What is Helm chart deployment?

Helm and Helm Charts Explained. Helm is a Kubernetes deployment tool for automating creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters. Kubernetes is a powerful container-orchestration system for application deployment.


3 Answers

If you are using Helm3:

To list all resources managed by the helm, use label selector with label app.kubernetes.io/managed-by=Helm:

$ kubectl get all --all-namespaces -l='app.kubernetes.io/managed-by=Helm'

To list all resources managed by the helm and part of a specific release: (edit release-name)

kubectl get all --all-namespaces -l='app.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=release-name'

Update:

Labels key may vary over time, follow the official documentation for the latest labels.

like image 160
Kamol Hasan Avatar answered Oct 07 '22 07:10

Kamol Hasan


helm get manifest RELEASE_NAME
helm get all RELEASE_NAME

https://helm.sh/docs/helm/helm_get_manifest/

like image 41
user3598726 Avatar answered Oct 07 '22 06:10

user3598726


I couldn't find anywhere that gave me what I wanted, so I wrote this one-liner using yq. It prints out all objects in Kind/name format. You might get some blank space if any manifests are nothing but comments.

helm get manifest $RELEASE_NAME | yq -N eval '[.kind, .metadata.name] | join("/")' - | sort

Published here: https://gist.github.com/bioshazard/e478d118fba9e26314bffebb88df1e33

like image 4
Joe Still Avatar answered Oct 07 '22 08:10

Joe Still