Is it possible to print to
helm install (or
helm upgrade) output the logs of the deploying containers (logs that are available by
kubectl logs command)?
Short answer: no. You would most likely run helm commands from your own workstation.
For those logs to be available through "kubectl logs", you would have to start a Pod, executing your "helm install" command. Maybe using a Job. Although this also means having some ServiceAccount with enough privileges to install objects on behalf of Helm.
Helm does not launch pods to deploy your workloads. Helm locally renders the charts into standard Kubernetes manifests, and applies them. There is no server side component to Helm (since Helm 3).
If you want to get logs from deployed pods, do so with standard
kubectl logs commands against the deployed pods. If you want to view what Helm is doing, use the
--debug parameter to Helm, which will output the manifests that Helm applied.
You can try a workaround by using the --wait flag with
helm install or
helm upgrade. This will cause the command to wait until the deployment is complete and all of the pods are ready, and then it will print the logs for the pods.
helm install my-release my-chart --wait
This will install the chart and then wait until the deployment is complete before printing the logs for the pods.
You can also specify a timeout for the --wait flag, like so:
helm install my-release my-chart --wait --timeout 600
This will wait up to 10 minutes for the deployment to complete before timing out and returning.
The catch is that the
--wait flag only works if the chart being installed or upgraded has a Deployment or StatefulSet as the primary resource type. It will not work with other resource types such as DaemonSet or Job.