Helm Get and Status


Helm Get and Status

In this tutorial, we are going to discuss about helm get and status option available within helm. Once the service is deployed within the cluster using helm then I can get the status using the status command or I can get more information using the get command.

Let’s see some options using get as well as status. Let’s check what are all the list of deployments available using helm list.

ashok@waytoeasylearn:~$ helm list
NAME                            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
install-upgrade-rollback-demo   default         1               2021-06-07 15:43:43.263589538 +0530 IST deployed        upgrade-rollback-0.3.0  1.16.0  

So this is the deployment. Let me get the deployment name and I can use the command helm get notes

ashok@waytoeasylearn:~$ helm get notes install-upgrade-rollback-demo
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=upgrade-rollback,app.kubernetes.io/instance=install-upgrade-rollback-demo" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT 

So that it will get me the notes mentioned for this particular deployment. In case after the deployment if you missed a specific note, I can go ahead and get the notes once again, by running this command helm get notes and then the deployment name.

Get Values

We can get what are all the values that were passed using the command prompt while starting this particular service, using the command helm get values and name of the service.

ashok@waytoeasylearn:~$ helm get values install-upgrade-rollback-demo
USER-SUPPLIED VALUES:
null

As such while doing the specific deployment, we did not pass any user defined values. So nothing getting listed.

Get Manifest

And how the templates were rendered I can get the rendered template using the command get manifest, helm get manifest and name of the deployment.

ashok@waytoeasylearn:~$ helm get manifest install-upgrade-rollback-demo
---
# Source: upgrade-rollback/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: install-upgrade-rollback-demo
  labels:
    helm.sh/chart: upgrade-rollback-0.3.0
    app.kubernetes.io/name: upgrade-rollback
    app.kubernetes.io/instance: install-upgrade-rollback-demo
    app.kubernetes.io/version: "1.16.0"
    app.kubernetes.io/managed-by: Helm
---
# Source: upgrade-rollback/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: install-upgrade-rollback-demo
  labels:
    helm.sh/chart: upgrade-rollback-0.3.0
    app.kubernetes.io/name: upgrade-rollback
    app.kubernetes.io/instance: install-upgrade-rollback-demo
    app.kubernetes.io/version: "1.16.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: upgrade-rollback
    app.kubernetes.io/instance: install-upgrade-rollback-demo
---
# Source: upgrade-rollback/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: install-upgrade-rollback-demo
  labels:
    helm.sh/chart: upgrade-rollback-0.3.0
    app.kubernetes.io/name: upgrade-rollback
    app.kubernetes.io/instance: install-upgrade-rollback-demo
    app.kubernetes.io/version: "1.16.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: upgrade-rollback
      app.kubernetes.io/instance: install-upgrade-rollback-demo
  template:
    metadata:
      labels:
        app.kubernetes.io/name: upgrade-rollback
        app.kubernetes.io/instance: install-upgrade-rollback-demo
    spec:
      serviceAccountName: install-upgrade-rollback-demo
      securityContext:
        {}
      containers:
        - name: upgrade-rollback
          securityContext:
            {}
          image: "nginx:1.16.0"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {}

So that’s going to get us the rendered manifest, by merging the template and the values and what was used to do the deployment of the entity within the Kubernetes cluster.

This will be useful to do the debugging in case if any of the deployed services not behaving as expected.

Get hooks

In case if I have added any hooks as a part of the deployment, I can use the command get hooks and then the deployment name.

ashok@waytoeasylearn:~$ helm get hooks install-upgrade-rollback-demo
---
# Source: upgrade-rollback/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
  name: "install-upgrade-rollback-demo-test-connection"
  labels:
    helm.sh/chart: upgrade-rollback-0.3.0
    app.kubernetes.io/name: upgrade-rollback
    app.kubernetes.io/instance: install-upgrade-rollback-demo
    app.kubernetes.io/version: "1.16.0"
    app.kubernetes.io/managed-by: Helm
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: wget
      image: busybox
      command: ['wget']
      args: ['install-upgrade-rollback-demo:80']
  restartPolicy: Never

In this case, if you remember earlier we discussed about the test condition that was a hook because it was added as a hook within the annotation and only that specific hook is getting listed.

So this particular command get hooked, it’s going to list all the hooks that were attached as a part of that specific deployment.

I can get all this information that is notes, values, manifest and hook using the command get all.

ashok@waytoeasylearn:~$ helm get all install-upgrade-rollback-demo

So where I will be getting the notes, values, manifest and hook.

So this is one way of verifying what got deployed and what values were deployed as a part of the services as well as I can get a quick status about that specific deployment using the command helm status and name of the deployment.

ashok@waytoeasylearn:~$ helm status install-upgrade-rollback-demo
NAME: install-upgrade-rollback-demo
LAST DEPLOYED: Mon Jun  7 15:43:43 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE:     install-upgrade-rollback-demo-test-connection
Last Started:   Mon Jun  7 15:44:40 2021
Last Completed: Mon Jun  7 15:44:45 2021
Phase:          Succeeded
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=upgrade-rollback,app.kubernetes.io/instance=install-upgrade-rollback-demo" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT 

That’s going to provide me the status of what provision is deployed and what is the status, in which namespace it was deployed, when it was deployed and what was the test suite that is hooked as a part of this specific deployment and whether that was invoked or not and the notes along with that specific deployment.

So basically, it’s going to give a quick summary on what was deployed and its current status.

Summary

So this is a quick summary on how to use the get and status command to understand about the deployment.

Helm Get and Status
Scroll to top