<p>i have 3 nodes
<code>kubectl get nodes</code></p>
<pre><code>NAME      STATUS   ROLES    AGE    VERSION
a1       Ready    master   133m   v1.18.6-gke.6600
a2       Ready    master   132m   v1.18.6-gke.6600
a3       Ready    master   132m   v1.18.6-gke.6600
</code></pre>
<p>so the status of that nodes is Ready I want to stop first node and again restart that nodes</p>
<p>i tried with</p>
<p><code>kubectl cordon a1</code></p>
<pre><code>NAME      STATUS                     ROLES    AGE    VERSION
a1     Ready,SchedulingDisabled   master   138m   v1.18.6-gke.6600
a2     Ready                      master   137m   v1.18.6-gke.6600
a3     Ready                      master   137m   v1.18.6-gke.6600
</code></pre>
<p>but my backend is still working and although if icordon all the nodes in that case also my backend is working i want my backend service will be stop and again resume
i also tried with</p>
<p><code>kubectl drain a1</code></p>
<pre><code>error: unable to drain node &quot;abm-cp2&quot;, aborting command...

There are pending nodes to be drained:
 a2
error: cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/anetd-4pr9j, kube-system/etcd-defrag-8fs99, kube-system/kube-proxy-8cgpf, kube-system/localpv-mlfnf, kube-system/metallb-speaker-ljsdv, kube-system/node-exporter-dfrnq, kube-system/stackdriver-log-forwarder-t5s88
</code></pre>

<p>May you are getting the wrong meaning of <strong>cordon</strong> and <strong>drain</strong> node.</p>
<p><strong>Cordon node</strong> :</p>
<p>it means no more <strong>new</strong> container will get the <strong>scheduled</strong> on this <strong>node</strong> however existing running container will be kept on that same node.</p>
<p><strong>Drain node</strong> :</p>
<p>The drain node will remove all the containers from that specific node and schedule all the containers to another node.</p>
<p>As much as I under what you want do is</p>
<blockquote>
<p>I want to stop first node and again restart those nodes</p>
</blockquote>
<p>if you can access the Node and do the SSH into worker nodes you can also run inside node after SSH : <code>systemctl restart kubelet</code></p>
<p><strong>OR</strong></p>
<p>you can stop or scale down the deployment to zero mean you can pause or restart the container or pod</p>
<p>with node you can delete node and new will will join the Kubernetes cluster.</p>
<pre><code>kubectl delete node a1
</code></pre>
<p>which will be similar to restarting the node in this case you must be using the node pools in GKE or AWS other cloud providers.</p>
<p><strong>Note</strong> : if you are running single replicas of you application you might face the downtime if delete the node or restart the <strong>kubelet</strong></p>
<p>i would suggest you to <strong>cordon</strong> and <strong>drain</strong> node before you <strong>restart</strong>.</p>
<ol>
<li><code>kubectl cordon a1</code> (stop new pod sceduling)</li>
<li><code>kubectl drain a1</code> (remove running containers)</li>
<li><code>kubectl delete node a1</code> (remove the node from cluster) or <code>systemctl restart kubelet</code> (restart the node)</li>
</ol>
<p>Regarding the error :</p>
<blockquote>
<p>There are pending nodes to be drained:  a2 error: cannot delete
DaemonSet-managed Pods</p>
</blockquote>
<p>You need to use the <code>--ignore-daemonsets</code> key when you drain Kubernetes nodes:</p>
<pre><code>--ignore-daemonsets=false: Ignore DaemonSet-managed pods.
</code></pre>
<p>so command will be something like</p>
<pre><code>kubectl drain node &lt;node-name&gt; --ignore-daemonsets
</code></pre>
