Occasionally you may wish to remove and replace a node in GKE Autopilot.
That can be done with
kubectl cordon $NODE_NAME
If you want to immediate drain the Pods and put them in the pending state, you can further drain the node:
kubectl drain $NODE_NAME --delete-emptydir-data --ignore-daemonsets
What about if you need to do all nodes? Be aware that this is pretty disruptive, and lot more aggressive than if you leave Autopilot to handle the upgrade itself (which is recommended), but you can apply this technique to the cluster as a whole like so:
for node in $(kubectl get nodes -o jsonpath='{.items[*].metadata.name}'); do
kubectl cordon $node
done