get a template resource - full yaml script code of helm (K8S)

2/24/2022

For helm command: helm create <chart name> there are several different templates, that are auto-generated.

i.e Deployment.yaml is a template of kind: Deployment.

When I run the command: kubectl api-resources, I found that there are many template resources.

I need to auto generate a resource (or get it from a hub template), i.e of kind: Pod, which is in the list of kubectl api-resources command.

How can I get that predefined template, such ad Pod template easily (the full yaml script for the template).

Thanks.

-- Eitan
kubernetes
kubernetes-helm
templates

1 Answer

2/25/2022

helm create outputs a fairly fixed structure. There is not an arbitrary resource generator, but rather a "usually works" template for a typical single-Deployment application. (See pkg/chartutil/create.go in the Helm source.)

If you want to add new templates, you need to use a text editor to create a new template file in the chart's templates directory. I'd recommend following the pattern in the existing templates for objects' metadata:, and maybe even starting by copying the existing generated deployment.yaml. Looking in the Kubernetes documentation and especially the API reference can help you find the fields for objects that are part of the standard Kubernetes system.

You usually do not want to create a bare Pod, but instead a Deployment or occasionally a StatefulSet. If you need to add a second Deployment to your application, copy the existing generated deployment.yaml file and edit the fields as needed.

-- David Maze
Source: StackOverflow