Kf Apps can be deployed on dedicated nodes in the cluster.
This feature is required if you have the circumstances where you might want more
control on a node where an App Pod lands. For example:

- If you are sharing the same cluster for different Apps but want dedicated nodes for a particular App.
- If you want dedicated nodes for a given organization (Kf Space).
- If you want to target a specific operating system like Windows.
- If you want to co-locate Pods from two different services that frequently communicate.

To enable compute isolation, Kf uses the Kubernetes [nodeSelector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node). To
use this feature, first add labels on the nodes or node pools where you want
your App Pods to land and then add the same qualifying labels on the Kf Space.
All the Apps installed in this Space then land on the nodes with matching labels.

## Configure nodeSelector in a Kf cluster

By default, compute isolation is disabled. Use the following procedure
to configure labels and nodeSelector.

1. Add a label (`distype=ssd`) on the node where you want your application pods to
   land.

   ```bash
   kubectl label nodes nodeid disktype=ssd
   ```
2. Add the same label on the Kf Space. All Apps deployed in this Space
   will then land on the qualifying nodes.

   ```bash
   kf configure-space set-nodeselector space-name disktype ssd
   ```

   You can add multiple labels by running the same command again.
3. Check the label is configured.

   ```bash
   kf configure-space get-nodeselector space-name
   ```
4. Delete the label from the space.

   ```bash
   kf configure-space unset-nodeselector space-name disktype
   ```

## Override nodeSelector for [Kf stacks](https://docs.cloud.google.com/migrate/kf/docs/2.7/cli/kf-stacks.md.txt)

Deployment of Kf Apps can be further targeted based
on what stack (buildpack) is being used to build and package the App. For
example, if you want your applications built with `spaceStacksV2` to land on
nodes with Linux kernel 4.4.1., `nodeSelector` values on a stack override the
values configured on the Space.

To configure the `nodeSelector` on a stack:

1. Edit the `config-defaults` of your Kf cluster and add the labels.

       $ kubectl -n kf edit configmaps config-defaults

2. Add `nodeSelector` to the stacks definition.

       .....
       .....
       spaceStacksV2: |
       - name:  cflinuxfs3
               image: cloudfoundry/cflinuxfs3
               nodeSelector:
                     OS_KERNEL: LINUX_4.4.1 
       .....
       .....