<p>We have an Azure-Kubernetes and use a helm chart to manage a list of deployments.</p>
<p>I would like to somehow block manual removal of the deployments. Deletion of the pods is fine, actually wanted to be able to &quot;restart&quot; the services inside to clean up cache and so on.</p>
<p>I'm sorry for the short question, am searching for a while but so far found nothing promising.</p>

Ackdari
<p>You can configure the RBAC into the K8s cluster.</p>
<p>Role for the <strong>deployment</strong> manager</p>
<pre><code>kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: deployment-manager
rules:
- apiGroups: [&quot;*&quot;]
  resources: [&quot;deployments&quot;, &quot;replicasets&quot;, &quot;pods&quot;]
  verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;, &quot;create&quot;, &quot;update&quot;, &quot;patch&quot;, &quot;delete&quot;]
</code></pre>
<p><strong>Role</strong> for <strong>developer</strong></p>
<pre><code>kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: developer
rules:
- apiGroups: [&quot;&quot;, &quot;extensions&quot;, &quot;apps&quot;]
  resources: [&quot;pods&quot;]
  verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;, &quot;create&quot;, &quot;update&quot;, &quot;patch&quot;, &quot;delete&quot;]
</code></pre>
<p><strong>Role binding deployment manager</strong></p>
<pre><code>kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: deployment-manager-binding
subjects:
- kind: User
  name: admin
  apiGroup: &quot;&quot;
roleRef:
  kind: Role
  name: deployment-manager
  apiGroup: &quot;&quot;
</code></pre>
<p><strong>Role binding developer</strong></p>
<pre><code>kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: developer-manager-binding
subjects:
- kind: User
  name: dev
  apiGroup: &quot;&quot;
roleRef:
  kind: Role
  name: developer
  apiGroup: &quot;&quot;
</code></pre>
<p>You can create two new <strong>K8s</strong> contexts and using that check</p>
<pre><code>kubectl --context=dev-context get pods
</code></pre>
<p>You can read more at : <a href="https://docs.bitnami.com/tutorials/configure-rbac-in-your-kubernetes-cluster/" rel="nofollow noreferrer">https://docs.bitnami.com/tutorials/configure-rbac-in-your-kubernetes-cluster/</a></p>
