<p>I have created a serviceaccount(<strong>dm-sa</strong>) in the default namespace and used this serviceaccount in the clusterRole (bound to a PodSecurityPolicy) and clusterRoleBinding.
Next, in the deployment yaml(which will run in the namespace "dm"), I specified serviceAccount: dm and serviceAccountName: default under the template:spec. With this, kubernetes is searching for the <strong>dm-sa</strong> under the namespace <strong>dm</strong>, <em>instead</em> of looking under the <strong>default</strong> namespace. How to solve this. Please help.</p>

<p>template:
    spec:
      automountServiceAccountToken: true
      serviceAccount: dm-sa
      serviceAccountName: default</p>

Naveen
<p>In general, when Kubernetes objects refer to each other, they need to be in the same namespace.  If a Deployment manages a Pod, and that refers to a ConfigMap, a Secret, a ServiceAccount, and a PersistentVolumeClaim, all of these things need to be in the same namespace.</p>

<p>I'd redeploy the service account in the target (<code>dm</code>) namespace.  You can delete the service account in the <code>default</code> namespace if you're not using it.</p>
