/
ros-talker-listener-demo.yaml
78 lines (74 loc) · 1.86 KB
/
ros-talker-listener-demo.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: my-network
spec:
config: '{
"cniVersion": "0.3.0",
"name": "my-network",
"type": "macvlan",
"master": "eth0",
"mode": "bridge",
"isDefaultgateway": true,
"ipam": {
"type": "host-local",
"ranges": [
[ {
"subnet": "192.168.0.0/16",
"rangeStart": "192.168.1.160",
"rangeEnd": "192.168.1.180",
"gateway": "192.168.1.1"
} ]
]
}
}'
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ros-talker-deployment
labels:
app: ros-talker
spec:
replicas: 2
selector:
matchLabels:
app: ros-talker
template:
metadata:
labels:
app: ros-talker
annotations:
k8s.v1.cni.cncf.io/networks: my-network
spec:
containers:
- name: talker
image: ros:foxy
command: ["/bin/bash", "-c"]
args: ["source /opt/ros/foxy/setup.bash && apt update && apt install -y curl && curl https://raw.githubusercontent.com/canonical/robotics-blog-k8s/main/publisher.py > publisher.py && /bin/python3 publisher.py talker"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ros-listener-deployment
labels:
app: ros-listener
annotations:
k8s.v1.cni.cncf.io/networks: my-network
spec:
replicas: 1
selector:
matchLabels:
app: ros-listener
template:
metadata:
labels:
app: ros-listener
annotations:
k8s.v1.cni.cncf.io/networks: my-network
spec:
containers:
- name: listener
image: ros:foxy
command: ["/bin/bash", "-c"]
args: ["source /opt/ros/foxy/setup.bash && apt update && apt install -y curl && curl https://raw.githubusercontent.com/canonical/robotics-blog-k8s/main/subscriber.py > subscriber.py && /bin/python3 subscriber.py listener"]