20

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.

D. Rao
  • 423
  • 2
  • 6
  • 16

7 Answers7

19
helm get manifest RELEASE_NAME
helm get all RELEASE_NAME

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

user3598726
  • 951
  • 2
  • 11
  • 27
13

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.

Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46
  • 1
    There is no varranty for labels you are describing. Documentation: https://helm.sh/docs/chart_best_practices/labels/#standard-labels This is what We can see in the documentation: `The following table defines common labels that Helm charts use. Helm itself never requires that a particular label be present. Labels that are marked REC are recommended, and should be placed onto a chart for global consistency.` – Daniel Hornik Sep 07 '21 at 18:35
  • Unfortunately, 'get all' does not list all resources. E.g. CRD-s, ClusterRoles, ClusterRoleBindings are not listed, just to mention a few. – tzp Mar 07 '23 at 19:09
7

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

Joe Still
  • 141
  • 1
  • 4
3

By issuing:

kubectl get all -n <namespace> | grep ...

You will only query for the following resources:

  • pod
  • service
  • daemonset
  • deployment
  • replicaset
  • statefulset
  • job
  • cronjobs

I encourage you to follow this article for more explanation:

Using the example from the above link you can query the API for all resources by issuing:

kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind -l LABEL=VALUE --ignore-not-found -o name

This command will query the API for all the resources types in the cluster and then query for each of the resources separately by label.

You can create resources in a Helm chart with labels and then query the API by specifying: -l LABEL=VALUE.


EXAMPLE

Assuming that you provisioned following Helm chart

  • $ helm install awesome-nginx stable/nginx-ingress

This Chart is deprecated but it's only for example purposes.

You can query the API for all resources with:

kubectl api-resources --verbs=list -o name | xargs -n 1 kubectl get --show-kind -l release=awesome-nginx --ignore-not-found -o name

where:

  • LABEL <- release
  • VALUE <- awesome-nginx (release name)

After that you should be able to see:

endpoints/awesome-nginx-nginx-ingress-controller
endpoints/awesome-nginx-nginx-ingress-default-backend
pod/awesome-nginx-nginx-ingress-controller-86b9c7d9c7-wwr8f
pod/awesome-nginx-nginx-ingress-default-backend-6979c95c78-xn9h2
serviceaccount/awesome-nginx-nginx-ingress
serviceaccount/awesome-nginx-nginx-ingress-backend
service/awesome-nginx-nginx-ingress-controller
service/awesome-nginx-nginx-ingress-default-backend
deployment.apps/awesome-nginx-nginx-ingress-controller
deployment.apps/awesome-nginx-nginx-ingress-default-backend
replicaset.apps/awesome-nginx-nginx-ingress-controller-86b9c7d9c7
replicaset.apps/awesome-nginx-nginx-ingress-default-backend-6979c95c78
podmetrics.metrics.k8s.io/awesome-nginx-nginx-ingress-controller-86b9c7d9c7-wwr8f
podmetrics.metrics.k8s.io/awesome-nginx-nginx-ingress-default-backend-6979c95c78-xn9h2
rolebinding.rbac.authorization.k8s.io/awesome-nginx-nginx-ingress
role.rbac.authorization.k8s.io/awesome-nginx-nginx-ingress

You can modify the output by changing the -o parameter.


Additional resources:

P....
  • 17,421
  • 2
  • 32
  • 52
Dawid Kruk
  • 8,982
  • 2
  • 22
  • 45
2

helm status RELEASE_NAME

This command shows the status of a named release. The status consists of:

  • last deployment time
  • k8s namespace in which the release lives
  • state of the release (can be: unknown, deployed, uninstalled, superseded, failed, uninstalling, pending-install, pending-upgrade or pending-rollback)
  • list of resources that this release consists of, sorted by kind
  • details on last test suite run, if applicable
  • additional notes provided by the chart

Usage: helm status RELEASE_NAME [flags]

Official docs

Also note that helm place some known labels/annotations on resource it manages, see here. You can use it with kubectl get ... -l ...

rkosegi
  • 14,165
  • 5
  • 50
  • 83
1

A bit late to this, but had this issue today, this was what i used,

helm status $RELEASE_NAME --show-resources

screenshot showing helm status command

See Helm documentation

SiHa
  • 7,830
  • 13
  • 34
  • 43
duoarc
  • 21
  • 4
0
kubectl get all -n <namespace>  | grep <helm chart keyword, ex: kibana, elasticsearch>

Should list all resources created by helm chart in a particular namespace