Restart server running inside Kubernetes Node

3/10/2019

I am having a IBM cloud powered kubernetes cluster. That cluster currently have only 1 node.
I verified running the command kubectl get nodes.
There are few servers which are running in that node. I want to restart one of those server. How can I get into the node and perform a restart for the required server?
I tried ssh, but this link says it cannot be done directly.

-- timekeeper
ibm-cloud
kubernetes

1 Answer

3/15/2019

Seems like your main questions are: "how to restart a pod", "how to ssh to a entity in which my service is running" and "how to see if I deleted a Pod".

First of all, most of this questions are already answered on StackOverflow. Second of all you need to get familiar with Kubernetes basic terminology and how things work in here. You can do that in any Kubernetes introduction or in documentation.

Answering the questions:

1) About restarting you can find information here. Or if you have running deployment, deleting a pod will result in pod recreation.

2) you can use kubectl execas described here: kubectl exec -ti pod_name sh(or bash)

3) to see your pods, run kubectl get pods after you run kubectl delete pod name -n namespace you can run kubectl get pods -w to see changing status of deleted pod and new one being spawned. Or you will notice that there is a new pod running but with different NAME.

-- aurelius
Source: StackOverflow