fujitatomoya / ros_k8s

Kuberenetes / ROS&ROS2 Cluster Samples
Creative Commons Attribution 4.0 International
185 stars 26 forks source link

How to confirm ROS1 nodes are running when following the "Setup Virtualized Kuberenetes Cluster" example? #23

Closed rfzeg closed 1 year ago

rfzeg commented 1 year ago

Thank you very much for making this repository available to us all!

I followed the instructions to "Install Kubernetes Packages" carefully, except for the Docker and Kubernetes installation, since I already had them installed. Then I pulled the pre-made ROS1 docker image tomoyafujita/ros:noetic from DockerHub.

Next I followed these instructions here (ROS1 part only): Setup Virtualized Kuberenetes Cluster

So far, so good, everything went well.

After staring the cluster with multiple nodes the tutorial suddenly ends. Therefore my question is "How do I inspect the Kubernetes pods to confirm I have two ROS1 nodes running?"

What I have done so far is to run this command here:

kubectl get pods -A

Which shows all the pods that I have currently running:

NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
kube-system          coredns-565d847f94-2gxsx                     0/1     Pending   0          16m
kube-system          coredns-565d847f94-8k4n5                     0/1     Pending   0          16m
kube-system          etcd-kind-control-plane                      1/1     Running   0          17m
kube-system          kube-apiserver-kind-control-plane            1/1     Running   0          17m
kube-system          kube-controller-manager-kind-control-plane   1/1     Running   0          16m
kube-system          kube-proxy-gcrjt                             1/1     Running   0          16m
kube-system          kube-proxy-stpjf                             1/1     Running   0          16m
kube-system          kube-scheduler-kind-control-plane            1/1     Running   0          16m
local-path-storage   local-path-provisioner-684f458cdd-4w8vt      0/1     Pending   0          16m

I notices that in my output it seems like three nodes are stuck in the Pending state. Regardless, this command provides me the name of the pods. Unfortunately by the name I can't really identify which pod is running a ROS node.

My plan is, once I have the name of the pod where my ROS node is running, to use the kubectl exec command to access the terminal of the pod. For example:

kubectl exec -it <pod-name> -- /bin/bash

If I manage to get inside the terminal of the pod, I would use the rosnode list command to see a list of all active ROS nodes running inside the pod.

My problem is with the command kubectl exec -it <pod-name> -- /bin/bash which doesn't seem to work:

Here are some examples that I have run and the output is right below:

kubectl exec -it etcd-kind-control-plane -- /bin/bash
Error from server (NotFound): pods "etcd-kind-control-plane" not found

kubectl exec -it kube-proxy-gcrjt -- /bin/bash
Error from server (NotFound): pods "kube-proxy-gcrjt" not found

kubectl exec -it kube-proxy-stpjf   -- /bin/bash
Error from server (NotFound): pods "kube-proxy-stpjf" not found

kubectl exec -it coredns-565d847f94-2gxsx  -- /bin/bash
Error from server (NotFound): pods "coredns-565d847f94-2gxsx" not found

kubectl exec -it coredns-565d847f94-8k4n5  -- /bin/bash
Error from server (NotFound): pods "coredns-565d847f94-8k4n5" not found

Is there something I am doing wrong? What am I missing in order to inspect the Kubernetes pods to confirm I have ROS1 nodes running?

Many thanks!

fujitatomoya commented 1 year ago

thanks for creating issue, i think you already solved this problem. and which is just a namespace.

kubectl exec -it --tty --stdin -n kube-system kube-proxy-stpjf -- /bin/bash should do the work. be advised that system component pods have kube-system namespace.

rfzeg commented 1 year ago

Yes the namespace was missing, thank you for your kind advice.

I had also another mistake since I initially skipped the Setup Kuberenetes Cluster document entirely. I skipped it because the initial sentence made me think that the entire document was meant to be the equivalent to the Setup Virtualized Kuberenetes Cluster document but for physical systems. Therefore, as I already said, I completely skipped the step "Deploy CNI plugin".

Later I realized that only section 1 is specific to physical systems and that I also needed to complete the "Deploy CNI plugin" part.

What is still not clear to me is if these sections here:

I also asume that the Dashboard, described under section "Kubernetes Dashboard" is optional, and the steps work on both cases (physical systems and also virtual Kubernetes cluster in single physical host system).

fujitatomoya commented 1 year ago

@rfzeg thanks for the advice, and agree. docs are best effort quality, there are some confusion...