I formed a k8s cluster with 5 nodes. I want to run a command on all nodes which equals:
k8s-node1: yum update k8s-node2: yum update k8s-node3: yum update k8s-node4: yum update k8s-node5: yum update
How to achieve this?
Just as cookiedough mentions. Your question is not Kubernetes related but rather Linux server administration in this case it also should not be asked on StackOverflow as it is for programming related topics.
You can find this question has been asked and answered here. And in similar cases where there is a need to run command or update on multiple machines. Just making this short you can use lots of tools like ansible, pssh or some script etc.
In case of existing pods on the Node and having a specific need to reboot the Node (for example kernel upgrade, libc upgrade etc.) you can read about this scenario in official documentation - Maintenance on a Node.