### What happened?

Currently, a running pod is being evicted if the assigned node, which does not meet the pod's node affinity requirements anymore, restarts its kubelet.

xref: https://github.com/kubernetes/kubernetes/issues/123980#issuecomment-2071554998

### What did you expect to happen?

https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity

![Screenshot 2024-04-23 at 3 51 20 PM](https://github.com/kubernetes/kubernetes/assets/19814047/5b15fcd0-3601-4b77-b863-6ca0970b107b)

According to the documentation, node affinity should only affect the scheduling phase. Therefore, the running pod should continue to run without interruption.

### How can we reproduce it (as minimally and precisely as possible)?

1. Create a deployment with node affinity.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test
  name: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: foo
                operator: In
                values:
                - bar
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
```
2. `kubectl label node TARGET_NODE foo=bar --overwrite` so that the pod is scheduled in the TARGET_NODE.
3. Waiting for the pod to be scheduled and running.
4. `kubectl label node TARGET_NODE foo=nonbar --overwrite`
5. Restart the kubelet of the TARGET_NODE.


### Anything else we need to know?

previous discussion: https://github.com/kubernetes/kubernetes/pull/101218#discussion_r627495203

### Kubernetes version

<details>

```console
$ kubectl version
# paste output here
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.31.0-alpha.0.470+7d880fd489d1e5-dirty
```

</details>


### Cloud provider

<details>
kind cluster
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>

Restarted kubelet should not evict pods due to the node affinity
This is a GitHub Issue
repo:kubernetes
owner:kubernetes
Title : Restarted kubelet should not evict pods due to the node affinity
Issue date:

--- start body ---
### What happened?

Currently, a running pod is being evicted if the assigned node, which does not meet the pod's node affinity requirements anymore, restarts its kubelet.

xref: https://github.com/kubernetes/kubernetes/issues/123980#issuecomment-2071554998

### What did you expect to happen?

https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity

![Screenshot 2024-04-23 at 3 51 20 PM](https://github.com/kubernetes/kubernetes/assets/19814047/5b15fcd0-3601-4b77-b863-6ca0970b107b)

According to the documentation, node affinity should only affect the scheduling phase. Therefore, the running pod should continue to run without interruption.

### How can we reproduce it (as minimally and precisely as possible)?

1. Create a deployment with node affinity.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test
  name: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: foo
                operator: In
                values:
                - bar
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
```
2. `kubectl label node TARGET_NODE foo=bar --overwrite` so that the pod is scheduled in the TARGET_NODE.
3. Waiting for the pod to be scheduled and running.
4. `kubectl label node TARGET_NODE foo=nonbar --overwrite`
5. Restart the kubelet of the TARGET_NODE.


### Anything else we need to know?

previous discussion: https://github.com/kubernetes/kubernetes/pull/101218#discussion_r627495203

### Kubernetes version

<details>

```console
$ kubectl version
# paste output here
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.31.0-alpha.0.470+7d880fd489d1e5-dirty
```

</details>


### Cloud provider

<details>
kind cluster
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>

--- end body ---
