Do you really need to uncordon it? The task is only to mark the node unschedulable and reschedule all the running pods on it. It should be done by issuing:
# drain node <node_name> --ignore-daemonsets
drain will safely evict all of the pods from a node, if there are daemon set-managed pods, drain will not proceed without using --ignore-daemonsets flag
The key thing here is to reschedule all POD's, if cluster has only single node and the controlplane then POD's won't get scheduled to controlplane. In this case either taints will need to be removed from controlplane or need to add tolerations to POD so that they can be scheduled on controlplane.
You are absolutely right. In my case, there where 3 nodes (1 master and 2 worker) so just cordon and then drain (i know drain alone can do the job, but cordon first and then drain is more complete) the worker node
i think you are right because its asking to rescheduling all pods which are running on ek8s-node-0 so when we cordon it pods will automatically rescheduling on another node.
Drain marks the node as unschedulable and also evict pods on the node. While, cordon, only marks the node as unschedulable. Hence, kubectl drain <node name> --ignore-daemonsets, would work in this case and also questions refers to only pods and not all objects.
This question can be tricky with pods that are NOT created as part of replicaSets. Then the pods will be terminated only and not rescheduled on other nodes. That needs to be checked before draining the node.
# Mark the node as unschedulable
kubectl cordon ek8s-node-0
# Delete all pods running on the node
kubectl delete pods --all --grace-period=0 --force --field-selector spec.nodeName=ek8s-node-0
No need to uncordon it. Draining the node will evict the nodes and mark it unschedulable.
# k drain <node_name> --ignore-daemonsets
# k get nodes
# k get pods -o wide (make sure existing pods are on other nodes)
don't need to run cordon if you're going to drain it. Drain will do it then evict all the pods in the node.
I'm confused the question didn't say we have to uncordon it eventually, why some comments are saying that we need to uncordon the node?
As i read this question i see that there are two actions required - make unavailable and reschedule. To make unavailable (or unschedulable) we need to cordon it and then drain, no?
would this be correct:
K get nodes
K drain ek8s-node-0 –ignore-demosets
Mark the node as unschedulable:
kubectl cordon ek8s-node-0
Delete the node:
kubectl delete node ek8s-node-0
kubectl get pods -o wide
The task does not asks to make it back available! I guess the exam checker will compare the LAST state of the node when ending the exam. If the node is uncordoned, how can the exam checker know that at some moment the node had been unscheduable.
I do not see the point of uncordon it.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Meliodas12
Highly Voted 1 year, 9 months agofemijohn123
1 year, 4 months agoimportme
9 months, 4 weeks agoVivekSolutionArchitect
1 year, 2 months agoPortman
1 year, 2 months agogtsvetko
Highly Voted 1 year, 9 months agoStunomatic
1 year, 1 month agoDevch0801
5 months, 2 weeks agonahid0002
Most Recent 1 month, 2 weeks agoHaiNgo
4 months, 3 weeks agocharlilec
7 months, 1 week agoKk14
8 months, 2 weeks agoanhayg
8 months, 3 weeks agoNatraj007
9 months, 1 week agoStargazer11
11 months, 2 weeks agobotsokui
1 year, 5 months agoreal111
1 year, 5 months agoreal111
1 year, 9 months agospocknimoy
1 year, 5 months agoHamiltonian
2 years, 1 month agoiiiaz
1 year, 5 months agonot4me
2 years, 1 month agogcpengineer
2 years, 2 months ago