Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support KubeEdge tutorial with far edge micro-ROS #3

Open
fujitatomoya opened this issue Jan 16, 2023 · 8 comments
Open

Support KubeEdge tutorial with far edge micro-ROS #3

fujitatomoya opened this issue Jan 16, 2023 · 8 comments

Comments

@fujitatomoya
Copy link
Owner

tutorial goes with https://kubeedge.io.

KubeEdge can good performance advantage to connect edge devices to Kubernetes Cluster running in the cloud infrastructure.
This tutorial does not include far edge micro-ROS device, but using host network interface to connect near edge devices running ROS 2 in the same network could be really useful example.

@fujitatomoya
Copy link
Owner Author

related to #9,

probably when developing the example for this, I can also bind edgemesh provided by https://github.com/kubeedge/edgemesh for network interface.

@fujitatomoya fujitatomoya changed the title Support KubeEdge tutorial w/o far edge micro-ROS Support KubeEdge tutorial with far edge micro-ROS Feb 24, 2023
@a732264856
Copy link

Hello,Can you tell me what changes need to be made on the deployment file to support Edgemesh, I tried this but failed, the talker node on the side could not connect to the rosmaster node on the cloud. (They are not in the same LAN.)
pod
service
erroor

@a732264856
Copy link

This is the content of the delpoyment file used, only the roscore service content has been modified based on your previous offer

############################

ROS master / roscore

############################

apiVersion: apps/v1
kind: Deployment
metadata:
name: roscore-deployment
labels:
app: ros1
node: roscore
spec:
replicas: 1
selector:
matchLabels:
node: roscore
template:
metadata:
labels:
node: roscore
spec:
containers:
- name: roscore
tty: true
image: tomoyafujita/ros:noetic
command: ["/bin/bash", "-c"]
args: ["source /opt/ros/$ROS_DISTRO/setup.bash && roscore"]
imagePullPolicy: IfNotPresent
ports:
- containerPort: 11311
name: roscoreport
nodeSelector:
nodetype: master
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule


Headless service declaration.

This is required to map to app roscore so that other pods can DNS rosmaster IP address dynamically.

apiVersion: v1
kind: Service
metadata:
name: rosmaster
labels:
app: ros1
node: roscore
spec:
#clusterIP: None
ports:
- port: 11311
targetPort: 11311
protocol: TCP
selector:
node: roscore


##################

ROS talker

##################

apiVersion: apps/v1
kind: Deployment
metadata:
name: talker-deployment
labels:
app: ros1
node: talker
spec:
replicas: 1
selector:
matchLabels:
node: talker
template:
metadata:
labels:
node: talker
spec:
containers:
- name: publisher
tty: true
image: tomoyafujita/ros:noetic
command: ["/bin/bash", "-c"]
args: ["source /opt/ros/$ROS_DISTRO/setup.bash && until rostopic list; do sleep 1; done && rosrun roscpp_tutorials talker"]
imagePullPolicy: IfNotPresent
env:
- name: ROS_MASTER_URI
value: http://rosmaster:11311
- name: ROS_HOSTNAME
value: ros-talker
nodeSelector:
nodetype: worker


Headless service declaration.

This is required to map to app publisher so that other pods can DNS IP address dynamically.

apiVersion: v1
kind: Service
metadata:
name: ros-talker
labels:
app: ros1
node: talker
spec:
clusterIP: None
selector:
node: talker


####################

ROS listener

####################

apiVersion: apps/v1
kind: Deployment
metadata:
name: listener-deployment
labels:
app: ros1
node: listener
spec:
replicas: 1
selector:
matchLabels:
node: listener
template:
metadata:
labels:
node: listener
spec:
containers:
- name: subscription
tty: true
image: tomoyafujita/ros:noetic
command: ["/bin/bash", "-c"]
args: ["source /opt/ros/$ROS_DISTRO/setup.bash && until rostopic list; do sleep 1; done && rosrun rospy_tutorials listener.py"]
imagePullPolicy: IfNotPresent
env:
- name: ROS_MASTER_URI
value: http://rosmaster:11311
- name: ROS_HOSTNAME
value: ros-listener
nodeSelector:
nodetype: master
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule


Headless service declaration.

This is required to map to app subscription so that other pods can DNS IP address dynamically.

apiVersion: v1
kind: Service
metadata:
name: ros-listener
labels:
app: ros1
node: listener
spec:
clusterIP: None
selector:
node: listener

@fujitatomoya
Copy link
Owner Author

unfortunately, i have not tried this configuration yet.

off the top of my head, i would try,

  • using ubuntu pods to make sure network can communicate each other.
  • are you using CNI? I believe that edgemesh takes control of iptables in host system. so probably it needs to bind the host network interface to container runtime?

@a732264856
Copy link

I used KubeEdge and EdgeMesh. Now I encountered a very strange situation. After I exposed port 11311 of ros_master, EdgeMesh could not access it. It was accessible the first time I used it, and then it wasn't, but I didn't make any changes
1679663814082
1679663860901

@fujitatomoya
Copy link
Owner Author

@a732264856 appreciate the information. this issue was meant to use KubeEdge with host network and connect micro-ROS devices as far edge devices. I would not probably use EdgeMesh at this moment. but that is really interesting and i need to catch up with it.

@fujitatomoya
Copy link
Owner Author

image

@fujitatomoya
Copy link
Owner Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants