<p>How can I execute &quot;helm install&quot; command and re-install resources that I have defined in &quot;templates&quot;? I have some custom resources that already exist so I want to re-install them. It is possible to do that through a parameter in helm command?</p>

Riccardo Califano
<p>I think your main question is:</p>
<blockquote>
<p>I have some custom resources that already exist so I want to re-install them.</p>
</blockquote>
<p>Which means <strong>DELETE</strong> then <strong>CREATE</strong> again.</p>
<h2>Short answer</h2>
<p>No.. but it can be done thru workaround</p>
<h2>Detailed answer</h2>
<p>Helm manages the RELEASE of the Kubernetes manifests by either:</p>
<ul>
<li>creating <code>helm install</code></li>
<li>updating <code>helm upgrade</code></li>
<li>deleting <code>helm delete</code></li>
</ul>
<p>However, you can recreate resources following one of these approaches :</p>
<p><strong>1. Twice Consecutive Upgrade</strong></p>
<p>If your chart is designed to enable/disable installation of resources with <strong>Values</strong> ( .e.g: <code>.Values.customResources.enabled</code>) you can do the following:</p>
<pre class="lang-sh prettyprint-override"><code>helm -n namespace upgrade &lt;helm-release&gt; &lt;chart&gt; --set customResources.enabled=false

# Then another Run
helm -n namespace upgrade &lt;helm-release&gt; &lt;chart&gt; --set customResources.enabled=true

</code></pre>
<p>So, if you are the builder of the chart, your task is to make the design functional.</p>
<p><strong>2. Using helmfile hooks</strong></p>
<p><a href="https://github.com/roboll/helmfile" rel="noreferrer">Helmfile</a> is Helm of Helm.</p>
<p>It manage your helm releases within a single file called <code>helmfile.yaml</code>.</p>
<p>Not only that, but it also can call some <strong>LOCAL commands</strong> before/or/after installing/or/upgrading a Helm release.
This call which happen before or after, is named <strong>hook</strong>.</p>
<p>For your case, you will need <strong>presync</strong> hook.</p>
<p>If we organize your helm release as a Helmfile definition , it should be :</p>
<pre class="lang-yaml prettyprint-override"><code>releases:
- name: &lt;helm-release&gt;
  chart: &lt;chart&gt;
  namespace: &lt;namespace&gt;
  hooks:
  - events: [&quot;presync&quot;]
    showlogs: true
    command: kubectl
    args: [ &quot;-n&quot;, &quot;{{`{{ .Release.Namespace }}`}}&quot;, &quot;delete&quot;, &quot;crd&quot;, &quot;my-custom-resources&quot; ]
</code></pre>
<p>Now you just need to run <code>helmfile apply</code></p>
<p>I know that CRD are not namespaced, but I put namespace in the hook just to demonstrate that Helmfile can give you the namespace of release as variable and no need to repeat your self.</p>
