<p>I'm trying to provision/deprovision service instance/binding from my cloud provider (IBM cloud private), Currently, there is a bug that if the service is not deprovisioned in ICP, that leaves me the orphan service instance on my ICP environment which I can't delete even with force option.
They provide a workaround solution of:</p>

<pre><code>kubectl edit ServiceInstance &lt;service-instance-name&gt;
kubectl edit ServiceBinding &lt;service-binding-name&gt;
</code></pre>

<p>then delete the line:</p>

<pre><code>...
finalizers:
    - kubernetes-incubator/service-catalog
...
</code></pre>

<p>and the orphan service instance/binding will get deleted properly. I'm wondering how to automate this process with bash cli (live edit + delete line + save + exit) or any alternative way.</p>

<p>I'm not sure how this works with the ServiceInstance and ServiceBinding specifically, but you can use <a href="https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/" rel="noreferrer">kubectl patch</a> to update objects in place. As an example:</p>
<pre><code>kubectl patch ServiceInstance &lt;service-instance-name&gt; -p '{&quot;metadata&quot;:{&quot;finalizers&quot;:null}}' --type=merge
</code></pre>
