# Pod placement

> For a Deployment, the default affinity spreads OPA Pods across Kubernetes nodes. A DaemonSet gets no default affinity.

You can configure Pod placement for OPA Pods as described in [Pod placement](https://docs.stackable.tech/home/stable/concepts/operations/pod_placement/index.md).

## Defaults

The default affinity depends on the [workload kind](https://docs.stackable.tech/home/stable/opa/usage-guide/workload-kind/index.md):

-   `DaemonSet`: none. A DaemonSet already places exactly one Pod per node.

-   `Deployment`: distribute all Pods of the `servers` role across nodes, so that multiple replicas don’t end up on the same Kubernetes node (weight 70)


The default affinity for a Deployment is:

```yaml
affinity:
  podAntiAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
    - podAffinityTerm:
        labelSelector:
          matchLabels:
            app.kubernetes.io/component: server
            app.kubernetes.io/instance: cluster-name
            app.kubernetes.io/name: opa
        topologyKey: kubernetes.io/hostname
      weight: 70
```

> **Note:** The default affinity is only preferred and not enforced, because not every setup has multiple Kubernetes nodes. To enforce it, set your own `requiredDuringSchedulingIgnoredDuringExecution` affinity. Be aware that a Deployment with more replicas than nodes then leaves Pods unschedulable.
