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.

- 698
- 15
- 37
-
Few servers running or few services running ? You can login to any worker node using creds or SSH. Since you are using IBM provided services you can use the IP to login – error404 Mar 10 '19 at 10:45
-
by servers, I meant services which run as servers like web server (nginx), elasticsearch servers.Regarding ssh using IP, I tried `ssh
@ – timekeeper Mar 10 '19 at 11:02` but it timed out. -
When you say "server" do you actually mean "Kubernetes pod"? – David Maze Mar 10 '19 at 11:20
-
The question needs to be formatted and explained well. Inside a node there are pods running - these pods are nothing but applications that are running as docker container using k8 as orchestration tool. The SSH will work only if the keys are available with you. Go through the doc if IBM again to check the keys or password configuration of the k8 cluster – error404 Mar 10 '19 at 11:31
-
@DavidMaze Yes. They are different kubernetes pod. In total, I got 10 different pods, and want to restart one of them. Additionallly, is there is a way to access the directory where the configs are stored inside the pod, it will be great. – timekeeper Mar 10 '19 at 12:06
-
@yashbagarka Thanks for explanation. – timekeeper Mar 10 '19 at 14:32
-
Possible duplicate of https://stackoverflow.com/questions/46123457/kubernetes-restart-container-within-pod – error404 Mar 10 '19 at 17:51
-
@yashbagarka Any idea how I can confirm if I delete a pod, kubernetes will default create a new pod with the same config. – timekeeper Mar 10 '19 at 19:56
-
You should manage your Pods with Deployments, and when you do this, when you `kubectl delete pod ...` it will get recreated. You should almost never need to ssh to a Node, get interactive shells in Pods, or directly change files in Pods. – David Maze Mar 10 '19 at 20:11
1 Answers
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 exec
as 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
.

- 3,433
- 1
- 13
- 22
-
Thanks for answering the questions. The comments helped me understand what I was really looking for and was planning to modify the question and add the answer myself this weekend. Thanks again. – timekeeper Mar 15 '19 at 21:40