> For the complete documentation index, see [llms.txt](https://til.duyet.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.duyet.net/data-engineering/kubernetes/helm-render-manifest-locally.md).

# Helm: render manifest locally

1. Install yq (`brew install yq`)
2. Download chart to local
3. Get values from release yaml
4. Using `helm template` to render manifest

```bash
function download {
  CHART_REPO=$(yq r ${1} spec.chart.repository)
  CHART_NAME=$(yq r ${1} spec.chart.name)
  CHART_VERSION=$(yq r ${1} spec.chart.version)
  CHART_DIR=${2}/${CHART_NAME}
  helm repo add ${CHART_NAME} ${CHART_REPO}
  helm fetch --version ${CHART_VERSION} --untar ${CHART_NAME}/${CHART_NAME} --untardir ${2}
  echo ${CHART_DIR}
}

HELM_RELEASE=my-release
TMPDIR=/tmp/${HELM_RELEASE}

# Download chart to local
CHART_DIR=$(download ${HELM_RELEASE} ${TMPDIR}| tail -n1)

# Custom values
yq r ./releases/$HELM_RELEASE.yaml spec.values > my-custom.values.yaml

HELM_RELEASE_NAME=$(yq r ${HELM_RELEASE} metadata.name)
HELM_RELEASE_NAMESPACE=$(yq r ${HELM_RELEASE} metadata.namespace)

# Render 
helm template ${HELM_RELEASE_NAME} ${CHART_DIR} --namespace $HELM_RELEASE_NAMESPACE --skip-crds true -f my-custom.values.yaml
```

Ref: <https://github.com/stefanprodan/hrval-action/blob/master/src/hrval.sh>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.duyet.net/data-engineering/kubernetes/helm-render-manifest-locally.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
