<p>We need to disable the automount of service account from our existing deployments in AKS cluster. There are 2 ways to do by adding the property &quot;automountserviceaccount : false&quot; in either in the service account manifest or pod template.</p>
<p>We are using separate service account specified in our application deployments, however when we looked in the namespace, there are default service account also created.</p>
<p>So inorder to secure our cluster, do we need to disable the automount property for both default and application specific service accounts?.</p>
<p>Since our app already live, will there be any impact by adding this to the service account s.</p>
<p>How to know the used service accounts of a pod and it's dependencies ?</p>

Vowneee
<blockquote>
<p>So inorder to secure our cluster, do we need to disable the automount property for both default and application specific service accounts?.</p>
</blockquote>
<p>The design behind the <code>default</code> ServiceAccount is that it does not have any rights unless you give them some. So from a security point of view there is not much need to disable the mount unless you granted them access for some reason. Instead, whenever an application truly needs some access, go ahead and create a ServiceAccount for that particular application and grant it the permissions it needs via RBAC.</p>
<blockquote>
<p>Since our app already live, will there be any impact by adding this to the service account s.</p>
</blockquote>
<p>In case you truly want to disable the mount there won't be an impact on your application if it didn't use the ServiceAccount beforehand. What is going to happen though, is that a new Pod will be created and the existing one is being delete. However, if you properly configured readinessProbes and a rolling update strategy, then Kubernetes will ensure that there will be no downtime.</p>
<blockquote>
<p>How to know the used service accounts of a pod and it's dependencies ?</p>
</blockquote>
<p>You can check what ServiceAccount a Pod is mounting by executing <code>kubectl get pods &lt;pod-name&gt; -o yaml</code>. The output is going to show you the entirety of the Pod's manifest and the field <code>spec.serviceAccountName</code> contains information on which ServiceAccount the Pod is mounting.</p>
