+++ edgex/Edge-X_3.1.postman_collection.json
... | ... | @@ -0,0 +1,189 @@ |
1 | +{ | |
2 | + "info": { | |
3 | + "_postman_id": "2a12e246-acc0-4fe5-950b-430ac62ee60e", | |
4 | + "name": "Edge-X 3.1", | |
5 | + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", | |
6 | + "_exporter_id": "15354547" | |
7 | + }, | |
8 | + "item": [ | |
9 | + { | |
10 | + "name": "ping", | |
11 | + "request": { | |
12 | + "method": "GET", | |
13 | + "header": [ | |
14 | + { | |
15 | + "key": "Content-Type", | |
16 | + "value": "application/json", | |
17 | + "type": "text" | |
18 | + } | |
19 | + ], | |
20 | + "url": "http://edgex_ip:59880/api/v3/ping" | |
21 | + }, | |
22 | + "response": [] | |
23 | + }, | |
24 | + { | |
25 | + "name": "Create Device Profile", | |
26 | + "request": { | |
27 | + "method": "POST", | |
28 | + "header": [ | |
29 | + { | |
30 | + "key": "Content-Type", | |
31 | + "value": "application/json", | |
32 | + "type": "text", | |
33 | + "disabled": true | |
34 | + } | |
35 | + ], | |
36 | + "body": { | |
37 | + "mode": "formdata", | |
38 | + "formdata": [ | |
39 | + { | |
40 | + "key": "file", | |
41 | + "type": "file", | |
42 | + "src": "/home/hwj/snap/postman/248/Postman/files/sensorClusterDeviceProfile.yaml" | |
43 | + } | |
44 | + ] | |
45 | + }, | |
46 | + "url": "http://edgex_ip:59881/api/v3/deviceprofile/uploadfile" | |
47 | + }, | |
48 | + "response": [] | |
49 | + }, | |
50 | + { | |
51 | + "name": "Device Profile All", | |
52 | + "request": { | |
53 | + "method": "GET", | |
54 | + "header": [ | |
55 | + { | |
56 | + "key": "Content-Type", | |
57 | + "value": "application/json", | |
58 | + "type": "text" | |
59 | + } | |
60 | + ], | |
61 | + "url": "http://edgex_ip:59881/api/v3/deviceprofile/all" | |
62 | + }, | |
63 | + "response": [] | |
64 | + }, | |
65 | + { | |
66 | + "name": "Device Profile", | |
67 | + "request": { | |
68 | + "method": "GET", | |
69 | + "header": [], | |
70 | + "url": "http://edgex_ip:59881/api/v3/deviceprofile/name/SensorCluster" | |
71 | + }, | |
72 | + "response": [] | |
73 | + }, | |
74 | + { | |
75 | + "name": "Create Device", | |
76 | + "request": { | |
77 | + "method": "POST", | |
78 | + "header": [ | |
79 | + { | |
80 | + "key": "Content-Type", | |
81 | + "value": "application/json", | |
82 | + "type": "text" | |
83 | + } | |
84 | + ], | |
85 | + "body": { | |
86 | + "mode": "raw", | |
87 | + "raw": " [\n {\n \"apiVersion\" : \"v3\",\n \"device\": {\n \"name\": \"Temp_and_Humidity_sensor_cluster_01\",\n \"description\": \"VORA-Kit\",\n \"adminState\": \"UNLOCKED\",\n \"operatingState\": \"UP\",\n \"labels\": [\n \"temperature\",\n \"humidity\"\n ],\n \"location\": \"Seoul\",\n \"serviceName\": \"device-rest\",\n \"profileName\": \"SensorCluster\",\n \"protocols\": {\n \"example\": {\n \"host\": \"dummy\",\n \"port\": \"1234\",\n \"unitID\": \"1\"\n }\n }\n }\n }\n ]", | |
88 | + "options": { | |
89 | + "raw": { | |
90 | + "language": "json" | |
91 | + } | |
92 | + } | |
93 | + }, | |
94 | + "url": "http://edgex_ip:59881/api/v3/device" | |
95 | + }, | |
96 | + "response": [] | |
97 | + }, | |
98 | + { | |
99 | + "name": "Device All", | |
100 | + "request": { | |
101 | + "method": "GET", | |
102 | + "header": [], | |
103 | + "url": "http://edgex_ip:59881/api/v3/device/all" | |
104 | + }, | |
105 | + "response": [] | |
106 | + }, | |
107 | + { | |
108 | + "name": "Device", | |
109 | + "request": { | |
110 | + "method": "GET", | |
111 | + "header": [], | |
112 | + "url": "http://edgex_ip:59881/api/v3/device/name/Temp_and_Humidity_sensor_cluster_01" | |
113 | + }, | |
114 | + "response": [] | |
115 | + }, | |
116 | + { | |
117 | + "name": "Temperature Test", | |
118 | + "request": { | |
119 | + "method": "POST", | |
120 | + "header": [], | |
121 | + "body": { | |
122 | + "mode": "raw", | |
123 | + "raw": "30", | |
124 | + "options": { | |
125 | + "raw": { | |
126 | + "language": "json" | |
127 | + } | |
128 | + } | |
129 | + }, | |
130 | + "url": "http://edgex_ip:59986/api/v3/resource/Temp_and_Humidity_sensor_cluster_01/temperature" | |
131 | + }, | |
132 | + "response": [] | |
133 | + }, | |
134 | + { | |
135 | + "name": "Reading event count", | |
136 | + "request": { | |
137 | + "method": "GET", | |
138 | + "header": [], | |
139 | + "url": "http://edgex_ip:59880/api/v3/event/count/device/name/Temp_and_Humidity_sensor_cluster_01" | |
140 | + }, | |
141 | + "response": [] | |
142 | + }, | |
143 | + { | |
144 | + "name": "Reading Sensor data", | |
145 | + "request": { | |
146 | + "method": "GET", | |
147 | + "header": [], | |
148 | + "url": "http://edgex_ip:59880/api/v3/reading/device/name/Temp_and_Humidity_sensor_cluster_01" | |
149 | + }, | |
150 | + "response": [] | |
151 | + }, | |
152 | + { | |
153 | + "name": "Create Streams", | |
154 | + "request": { | |
155 | + "method": "POST", | |
156 | + "header": [], | |
157 | + "body": { | |
158 | + "mode": "raw", | |
159 | + "raw": "{\n \"sql\": \"create stream edgex_tutorial() WITH (FORMAT=\\\"JSON\\\", TYPE=\\\"edgex\\\")\"\n}", | |
160 | + "options": { | |
161 | + "raw": { | |
162 | + "language": "json" | |
163 | + } | |
164 | + } | |
165 | + }, | |
166 | + "url": "http://edgex_ip:59720/streams" | |
167 | + }, | |
168 | + "response": [] | |
169 | + }, | |
170 | + { | |
171 | + "name": "Create Rules - temphum", | |
172 | + "request": { | |
173 | + "method": "POST", | |
174 | + "header": [], | |
175 | + "body": { | |
176 | + "mode": "raw", | |
177 | + "raw": "{\n \"id\": \"temphum\",\n \"sql\": \"SELECT * FROM edgex_tutorial\",\n \"actions\": [\n {\n \"mqtt\": {\n \"server\": \"tcp://192.168.0.11:30100\",\n \"topic\": \"temphum\"\n }\n },\n {\n \"log\":{}\n }\n ]\n}", | |
178 | + "options": { | |
179 | + "raw": { | |
180 | + "language": "json" | |
181 | + } | |
182 | + } | |
183 | + }, | |
184 | + "url": "http://edgex_ip:59720/rules" | |
185 | + }, | |
186 | + "response": [] | |
187 | + } | |
188 | + ] | |
189 | +}(파일 끝에 줄바꿈 문자 없음) |
+++ edgex/Temp_Hum_Sensor.py
... | ... | @@ -0,0 +1,37 @@ |
1 | +import sys, time, requests, json | |
2 | +import Adafruit_DHT | |
3 | + | |
4 | +sensor = Adafruit_DHT.DHT11 | |
5 | +pin = 2 | |
6 | + | |
7 | +edgexip = "blueshift.xslab.co.kr" | |
8 | +edgexfort ="9797" | |
9 | + | |
10 | +try: | |
11 | + | |
12 | + while True : | |
13 | + | |
14 | + rawHum, rawTemp = Adafruit_DHT.read_retry(sensor, pin) | |
15 | + | |
16 | + if rawHum is not None and rawTemp is not None : | |
17 | + | |
18 | + urlTemp = 'http://%s:%s/api/v1/resource/Temp_and_Humidity_sensor_cluster_01/temperature' % (edgexip, edgexfort) | |
19 | + urlHum = 'http://%s:%s/api/v1/resource/Temp_and_Humidity_sensor_cluster_01/humidity' % (edgexip, edgexfort) | |
20 | + | |
21 | + humval = str(rawHum) | |
22 | + tempval = str(rawTemp) | |
23 | + | |
24 | + headers = {'content-type': 'application/json'} | |
25 | + response = requests.post(urlTemp, data=json.dumps(int(rawTemp)), headers=headers,verify=False) | |
26 | + response = requests.post(urlHum, data=json.dumps(int(rawHum)), headers=headers,verify=False) | |
27 | + | |
28 | + print("Temp: %s\N{DEGREE SIGN}C, humidity: %s%%" % (tempval, humval)) | |
29 | + | |
30 | + else : | |
31 | + print('Read error') | |
32 | + time.sleep(100) | |
33 | +except KeyboardInterrupt: | |
34 | + print("Terminated by Keyboard") | |
35 | + | |
36 | +finally: | |
37 | + print("End of Program") |
+++ edgex/docker-compose.yml
... | ... | @@ -0,0 +1,488 @@ |
1 | +# * Copyright 2023 Intel Corporation. | |
2 | +# * | |
3 | +# * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
4 | +# * in compliance with the License. You may obtain a copy of the License at | |
5 | +# * | |
6 | +# * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | +# * | |
8 | +# * Unless required by applicable law or agreed to in writing, software distributed under the License | |
9 | +# * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
10 | +# * or implied. See the License for the specific language governing permissions and limitations under | |
11 | +# * the License. | |
12 | +# * | |
13 | +# * EdgeX Foundry, Napa release | |
14 | +# *******************************************************************************/ | |
15 | +# | |
16 | +# | |
17 | +# | |
18 | +# ************************ This is a generated compose file **************************** | |
19 | +# | |
20 | +# DO NOT MAKE CHANGES that are intended to be permanent to EdgeX edgex-compose repo. | |
21 | +# | |
22 | +# Permanent changes can be made to the source compose files located in the compose-builder folder | |
23 | +# at the top level of the edgex-compose repo. | |
24 | +# | |
25 | +# From the compose-builder folder use `make build` to regenerate all standard compose files variations | |
26 | +# | |
27 | +name: edgex | |
28 | +services: | |
29 | + app-rules-engine: | |
30 | + container_name: edgex-app-rules-engine | |
31 | + depends_on: | |
32 | + consul: | |
33 | + condition: service_started | |
34 | + core-data: | |
35 | + condition: service_started | |
36 | + environment: | |
37 | + EDGEX_PROFILE: rules-engine | |
38 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
39 | + SERVICE_HOST: edgex-app-rules-engine | |
40 | + hostname: edgex-app-rules-engine | |
41 | + image: registry.xslab.co.kr/lecture/docker-app-service-configurable-arm64:3.1.0 | |
42 | + networks: | |
43 | + edgex-network: null | |
44 | + ports: | |
45 | + - mode: ingress | |
46 | + host_ip: 0.0.0.0 | |
47 | + target: 59701 | |
48 | + published: "59701" | |
49 | + protocol: tcp | |
50 | + read_only: true | |
51 | + restart: always | |
52 | + security_opt: | |
53 | + - no-new-privileges:true | |
54 | + user: 2002:2001 | |
55 | + volumes: | |
56 | + - type: bind | |
57 | + source: /etc/localtime | |
58 | + target: /etc/localtime | |
59 | + read_only: true | |
60 | + bind: | |
61 | + create_host_path: true | |
62 | + consul: | |
63 | + command: | |
64 | + - agent | |
65 | + - -ui | |
66 | + - -bootstrap | |
67 | + - -server | |
68 | + - -client | |
69 | + - 0.0.0.0 | |
70 | + container_name: edgex-core-consul | |
71 | + hostname: edgex-core-consul | |
72 | + image: registry.xslab.co.kr/lecture/docker-edgex-consul-arm64:1.16.2 | |
73 | + networks: | |
74 | + edgex-network: null | |
75 | + ports: | |
76 | + - mode: ingress | |
77 | + host_ip: 0.0.0.0 | |
78 | + target: 8500 | |
79 | + published: "8500" | |
80 | + protocol: tcp | |
81 | + read_only: true | |
82 | + restart: always | |
83 | + security_opt: | |
84 | + - no-new-privileges:true | |
85 | + user: root:root | |
86 | + volumes: | |
87 | + - type: volume | |
88 | + source: consul-config | |
89 | + target: /consul/config | |
90 | + volume: {} | |
91 | + - type: volume | |
92 | + source: consul-data | |
93 | + target: /consul/data | |
94 | + volume: {} | |
95 | + core-command: | |
96 | + container_name: edgex-core-command | |
97 | + depends_on: | |
98 | + consul: | |
99 | + condition: service_started | |
100 | + core-metadata: | |
101 | + condition: service_started | |
102 | + database: | |
103 | + condition: service_started | |
104 | + environment: | |
105 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
106 | + EXTERNALMQTT_URL: tcp://edgex-mqtt-broker:1883 | |
107 | + SERVICE_HOST: edgex-core-command | |
108 | + hostname: edgex-core-command | |
109 | + image: registry.xslab.co.kr/lecture/docker-core-command-go-arm64:3.1.0 | |
110 | + networks: | |
111 | + edgex-network: null | |
112 | + ports: | |
113 | + - mode: ingress | |
114 | + host_ip: 0.0.0.0 | |
115 | + target: 59882 | |
116 | + published: "59882" | |
117 | + protocol: tcp | |
118 | + read_only: true | |
119 | + restart: always | |
120 | + security_opt: | |
121 | + - no-new-privileges:true | |
122 | + user: 2002:2001 | |
123 | + volumes: | |
124 | + - type: bind | |
125 | + source: /etc/localtime | |
126 | + target: /etc/localtime | |
127 | + read_only: true | |
128 | + bind: | |
129 | + create_host_path: true | |
130 | + core-common-config-bootstrapper: | |
131 | + container_name: edgex-core-common-config-bootstrapper | |
132 | + depends_on: | |
133 | + consul: | |
134 | + condition: service_started | |
135 | + environment: | |
136 | + ALL_SERVICES_DATABASE_HOST: edgex-redis | |
137 | + ALL_SERVICES_MESSAGEBUS_HOST: edgex-redis | |
138 | + ALL_SERVICES_REGISTRY_HOST: edgex-core-consul | |
139 | + APP_SERVICES_CLIENTS_CORE_METADATA_HOST: edgex-core-metadata | |
140 | + DEVICE_SERVICES_CLIENTS_CORE_METADATA_HOST: edgex-core-metadata | |
141 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
142 | + hostname: edgex-core-common-config-bootstrapper | |
143 | + image: registry.xslab.co.kr/lecture/docker-core-common-config-bootstrapper-go-arm64:3.1.0 | |
144 | + networks: | |
145 | + edgex-network: null | |
146 | + read_only: true | |
147 | + security_opt: | |
148 | + - no-new-privileges:true | |
149 | + user: 2002:2001 | |
150 | + volumes: | |
151 | + - type: bind | |
152 | + source: /etc/localtime | |
153 | + target: /etc/localtime | |
154 | + read_only: true | |
155 | + bind: | |
156 | + create_host_path: true | |
157 | + core-data: | |
158 | + container_name: edgex-core-data | |
159 | + depends_on: | |
160 | + consul: | |
161 | + condition: service_started | |
162 | + core-metadata: | |
163 | + condition: service_started | |
164 | + database: | |
165 | + condition: service_started | |
166 | + environment: | |
167 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
168 | + SERVICE_HOST: edgex-core-data | |
169 | + hostname: edgex-core-data | |
170 | + image: registry.xslab.co.kr/lecture/docker-core-data-go-arm64:3.1.0 | |
171 | + networks: | |
172 | + edgex-network: null | |
173 | + ports: | |
174 | + - mode: ingress | |
175 | + host_ip: 0.0.0.0 | |
176 | + target: 59880 | |
177 | + published: "59880" | |
178 | + protocol: tcp | |
179 | + read_only: true | |
180 | + restart: always | |
181 | + security_opt: | |
182 | + - no-new-privileges:true | |
183 | + user: 2002:2001 | |
184 | + volumes: | |
185 | + - type: bind | |
186 | + source: /etc/localtime | |
187 | + target: /etc/localtime | |
188 | + read_only: true | |
189 | + bind: | |
190 | + create_host_path: true | |
191 | + core-metadata: | |
192 | + container_name: edgex-core-metadata | |
193 | + depends_on: | |
194 | + consul: | |
195 | + condition: service_started | |
196 | + database: | |
197 | + condition: service_started | |
198 | + environment: | |
199 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
200 | + SERVICE_HOST: edgex-core-metadata | |
201 | + hostname: edgex-core-metadata | |
202 | + image: registry.xslab.co.kr/lecture/docker-core-metadata-go-arm64:3.1.0 | |
203 | + networks: | |
204 | + edgex-network: null | |
205 | + ports: | |
206 | + - mode: ingress | |
207 | + host_ip: 0.0.0.0 | |
208 | + target: 59881 | |
209 | + published: "59881" | |
210 | + protocol: tcp | |
211 | + read_only: true | |
212 | + restart: always | |
213 | + security_opt: | |
214 | + - no-new-privileges:true | |
215 | + user: 2002:2001 | |
216 | + volumes: | |
217 | + - type: bind | |
218 | + source: /etc/localtime | |
219 | + target: /etc/localtime | |
220 | + read_only: true | |
221 | + bind: | |
222 | + create_host_path: true | |
223 | + database: | |
224 | + container_name: edgex-redis | |
225 | + hostname: edgex-redis | |
226 | + image: registry.xslab.co.kr/lecture/redis:7.0.14 | |
227 | + networks: | |
228 | + edgex-network: null | |
229 | + ports: | |
230 | + - mode: ingress | |
231 | + host_ip: 0.0.0.0 | |
232 | + target: 6379 | |
233 | + published: "6379" | |
234 | + protocol: tcp | |
235 | + read_only: true | |
236 | + restart: always | |
237 | + security_opt: | |
238 | + - no-new-privileges:true | |
239 | + user: root:root | |
240 | + volumes: | |
241 | + - type: volume | |
242 | + source: db-data | |
243 | + target: /data | |
244 | + volume: {} | |
245 | + device-rest: | |
246 | + container_name: edgex-device-rest | |
247 | + depends_on: | |
248 | + consul: | |
249 | + condition: service_started | |
250 | + core-data: | |
251 | + condition: service_started | |
252 | + core-metadata: | |
253 | + condition: service_started | |
254 | + environment: | |
255 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
256 | + SERVICE_HOST: edgex-device-rest | |
257 | + hostname: edgex-device-rest | |
258 | + image: registry.xslab.co.kr/lecture/docker-device-rest-go-arm64:3.1.0 | |
259 | + networks: | |
260 | + edgex-network: null | |
261 | + ports: | |
262 | + - mode: ingress | |
263 | + host_ip: 0.0.0.0 | |
264 | + target: 59986 | |
265 | + published: "59986" | |
266 | + protocol: tcp | |
267 | + read_only: true | |
268 | + restart: always | |
269 | + security_opt: | |
270 | + - no-new-privileges:true | |
271 | + user: 2002:2001 | |
272 | + volumes: | |
273 | + - type: bind | |
274 | + source: /etc/localtime | |
275 | + target: /etc/localtime | |
276 | + read_only: true | |
277 | + bind: | |
278 | + create_host_path: true | |
279 | +# device-virtual: | |
280 | +# container_name: edgex-device-virtual | |
281 | +# depends_on: | |
282 | +# consul: | |
283 | +# condition: service_started | |
284 | +# core-data: | |
285 | +# condition: service_started | |
286 | +# core-metadata: | |
287 | +# condition: service_started | |
288 | +# environment: | |
289 | +# EDGEX_SECURITY_SECRET_STORE: "false" | |
290 | +# SERVICE_HOST: edgex-device-virtual | |
291 | +# hostname: edgex-device-virtual | |
292 | +# image: edgexfoundry/device-virtual-arm64:3.1.0 | |
293 | +# networks: | |
294 | +# edgex-network: null | |
295 | +# ports: | |
296 | +# - mode: ingress | |
297 | +# host_ip: 0.0.0.0 | |
298 | +# target: 59900 | |
299 | +# published: "59900" | |
300 | +# protocol: tcp | |
301 | +# read_only: true | |
302 | +# restart: always | |
303 | +# security_opt: | |
304 | +# - no-new-privileges:true | |
305 | +# user: 2002:2001 | |
306 | +# volumes: | |
307 | +# - type: bind | |
308 | +# source: /etc/localtime | |
309 | +# target: /etc/localtime | |
310 | +# read_only: true | |
311 | +# bind: | |
312 | +# create_host_path: true | |
313 | + kuiper-manager: | |
314 | + container_name: ekuiper-manager | |
315 | + image: registry.xslab.co.kr/lecture/kuiper-manager:1.9.5 | |
316 | + ports: | |
317 | + - "9082:9082" | |
318 | + networks: | |
319 | + edgex-network: null | |
320 | + environment: | |
321 | + DEFAULT_EKUIPER_ENDPOINT: "http://edgex-kuiper:59720" | |
322 | + rules-engine: | |
323 | + container_name: edgex-kuiper | |
324 | + depends_on: | |
325 | + database: | |
326 | + condition: service_started | |
327 | + environment: | |
328 | + CONNECTION__EDGEX__REDISMSGBUS__PORT: "6379" | |
329 | + CONNECTION__EDGEX__REDISMSGBUS__PROTOCOL: redis | |
330 | + CONNECTION__EDGEX__REDISMSGBUS__SERVER: edgex-redis | |
331 | + CONNECTION__EDGEX__REDISMSGBUS__TYPE: redis | |
332 | + EDGEX__DEFAULT__PORT: "6379" | |
333 | + EDGEX__DEFAULT__PROTOCOL: redis | |
334 | + EDGEX__DEFAULT__SERVER: edgex-redis | |
335 | + EDGEX__DEFAULT__TOPIC: edgex/rules-events | |
336 | + EDGEX__DEFAULT__TYPE: redis | |
337 | + KUIPER__BASIC__CONSOLELOG: "true" | |
338 | + KUIPER__BASIC__RESTPORT: "59720" | |
339 | + hostname: edgex-kuiper | |
340 | + image: registry.xslab.co.kr/lecture/kuiper:1.11.4 | |
341 | + networks: | |
342 | + edgex-network: null | |
343 | + ports: | |
344 | + - "9081:9081" | |
345 | + - mode: ingress | |
346 | + host_ip: 0.0.0.0 | |
347 | + target: 59720 | |
348 | + published: "59720" | |
349 | + protocol: tcp | |
350 | + read_only: true | |
351 | + restart: always | |
352 | + security_opt: | |
353 | + - no-new-privileges:true | |
354 | + user: kuiper:kuiper | |
355 | + volumes: | |
356 | + - type: bind | |
357 | + source: /etc/localtime | |
358 | + target: /etc/localtime | |
359 | + read_only: true | |
360 | + bind: | |
361 | + create_host_path: true | |
362 | + - type: volume | |
363 | + source: kuiper-data | |
364 | + target: /kuiper/data | |
365 | + volume: {} | |
366 | + - type: volume | |
367 | + source: kuiper-etc | |
368 | + target: /kuiper/etc | |
369 | + volume: {} | |
370 | + - type: volume | |
371 | + source: kuiper-log | |
372 | + target: /kuiper/log | |
373 | + volume: {} | |
374 | + - type: volume | |
375 | + source: kuiper-plugins | |
376 | + target: /kuiper/plugins | |
377 | + volume: {} | |
378 | + support-notifications: | |
379 | + container_name: edgex-support-notifications | |
380 | + depends_on: | |
381 | + consul: | |
382 | + condition: service_started | |
383 | + database: | |
384 | + condition: service_started | |
385 | + environment: | |
386 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
387 | + SERVICE_HOST: edgex-support-notifications | |
388 | + hostname: edgex-support-notifications | |
389 | + image: registry.xslab.co.kr/lecture/docker-support-notifications-go-arm64:3.1.0 | |
390 | + networks: | |
391 | + edgex-network: null | |
392 | + ports: | |
393 | + - mode: ingress | |
394 | + host_ip: 0.0.0.0 | |
395 | + target: 59860 | |
396 | + published: "59860" | |
397 | + protocol: tcp | |
398 | + read_only: true | |
399 | + restart: always | |
400 | + security_opt: | |
401 | + - no-new-privileges:true | |
402 | + user: 2002:2001 | |
403 | + volumes: | |
404 | + - type: bind | |
405 | + source: /etc/localtime | |
406 | + target: /etc/localtime | |
407 | + read_only: true | |
408 | + bind: | |
409 | + create_host_path: true | |
410 | + support-scheduler: | |
411 | + container_name: edgex-support-scheduler | |
412 | + depends_on: | |
413 | + consul: | |
414 | + condition: service_started | |
415 | + database: | |
416 | + condition: service_started | |
417 | + environment: | |
418 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
419 | + INTERVALACTIONS_SCRUBAGED_HOST: edgex-core-data | |
420 | + INTERVALACTIONS_SCRUBPUSHED_HOST: edgex-core-data | |
421 | + SERVICE_HOST: edgex-support-scheduler | |
422 | + hostname: edgex-support-scheduler | |
423 | + image: registry.xslab.co.kr/lecture/docker-support-scheduler-go-arm64:3.1.0 | |
424 | + networks: | |
425 | + edgex-network: null | |
426 | + ports: | |
427 | + - mode: ingress | |
428 | + host_ip: 0.0.0.0 | |
429 | + target: 59861 | |
430 | + published: "59861" | |
431 | + protocol: tcp | |
432 | + read_only: true | |
433 | + restart: always | |
434 | + security_opt: | |
435 | + - no-new-privileges:true | |
436 | + user: 2002:2001 | |
437 | + volumes: | |
438 | + - type: bind | |
439 | + source: /etc/localtime | |
440 | + target: /etc/localtime | |
441 | + read_only: true | |
442 | + bind: | |
443 | + create_host_path: true | |
444 | + ui: | |
445 | + container_name: edgex-ui-go | |
446 | + environment: | |
447 | + EDGEX_SECURITY_SECRET_STORE: "false" | |
448 | + SERVICE_HOST: edgex-ui-go | |
449 | + hostname: edgex-ui-go | |
450 | + image: registry.xslab.co.kr/lecture/docker-edgex-ui-go-arm64:3.1.0 | |
451 | + networks: | |
452 | + edgex-network: null | |
453 | + ports: | |
454 | + - mode: ingress | |
455 | + target: 4000 | |
456 | + published: "4000" | |
457 | + protocol: tcp | |
458 | + read_only: true | |
459 | + restart: always | |
460 | + security_opt: | |
461 | + - no-new-privileges:true | |
462 | + user: 2002:2001 | |
463 | + volumes: | |
464 | + - type: bind | |
465 | + source: /etc/localtime | |
466 | + target: /etc/localtime | |
467 | + read_only: true | |
468 | + bind: | |
469 | + create_host_path: true | |
470 | +networks: | |
471 | + edgex-network: | |
472 | + name: edgex_edgex-network | |
473 | + driver: bridge | |
474 | +volumes: | |
475 | + consul-config: | |
476 | + name: edgex_consul-config | |
477 | + consul-data: | |
478 | + name: edgex_consul-data | |
479 | + db-data: | |
480 | + name: edgex_db-data | |
481 | + kuiper-data: | |
482 | + name: edgex_kuiper-data | |
483 | + kuiper-etc: | |
484 | + name: edgex_kuiper-etc | |
485 | + kuiper-log: | |
486 | + name: edgex_kuiper-log | |
487 | + kuiper-plugins: | |
488 | + name: edgex_kuiper-plugins |
+++ edgex/docker-install.sh
... | ... | @@ -0,0 +1,45 @@ |
1 | +#! /bin/bash | |
2 | +# sudo로 실행 필요 | |
3 | +# docker 설치 | |
4 | + | |
5 | +apt-get update | |
6 | +apt-get install -y ca-certificates curl gnupg lsb-release | |
7 | + | |
8 | +install -m 0755 -d /etc/apt/keyrings | |
9 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
10 | +chmod a+r /etc/apt/keyrings/docker.asc | |
11 | + | |
12 | +echo \ | |
13 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
14 | + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
15 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
16 | + | |
17 | +apt-get update | |
18 | +apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
19 | + | |
20 | +# Cgroup를 systemd로 설정 | |
21 | +cat > /etc/docker/daemon.json <<EOF | |
22 | +{ | |
23 | + "exec-opts": ["native.cgroupdriver=systemd"], | |
24 | + "log-driver": "json-file", | |
25 | + "log-opts": { | |
26 | + "max-size": "100m" | |
27 | + }, | |
28 | + "storage-driver": "overlay2" | |
29 | +} | |
30 | +EOF | |
31 | + | |
32 | +mkdir -p /etc/systemd/system/docker.service.d | |
33 | +systemctl daemon-reload | |
34 | +systemctl restart docker | |
35 | +sudo systemctl enable docker | |
36 | + | |
37 | +# 일반유저 Docker 사용 | |
38 | +usermod -aG docker vraptor | |
39 | + | |
40 | +apt-get install -y bash-completion | |
41 | + | |
42 | +curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh | |
43 | + | |
44 | +apt-get install -y docker-compose | |
45 | + |
+++ edgex/random_data_push.py
... | ... | @@ -0,0 +1,60 @@ |
1 | +import time, sys, requests, json | |
2 | +#import board | |
3 | +#import adafruit_dht | |
4 | +import random | |
5 | + | |
6 | +# 데이터 핀 3번을 사용면, GPIO2로 설정 | |
7 | +#pin = board.D2 | |
8 | +#dhtDevice = adafruit_dht.DHT11(pin) | |
9 | + | |
10 | +# EdgeX server ip | |
11 | +edgexip = "edgex_ip" | |
12 | + | |
13 | +while True: | |
14 | + try: | |
15 | + # 온도 및 습도 값을 읽어옴 | |
16 | + | |
17 | + #온도 | |
18 | + #temperature_c = dhtDevice.temperature | |
19 | + temperature_c = random.uniform(35, 40) | |
20 | + temperature_f = temperature_c * (9 / 5) + 32 | |
21 | + | |
22 | + #습도 | |
23 | + #humidity = dhtDevice.humidity | |
24 | + humidity = random.uniform(20, 80) | |
25 | + | |
26 | + print( | |
27 | + "온도: {:.1f} F / {:.1f} C 습도: {:.1f} % ".format( | |
28 | + temperature_f, temperature_c, humidity | |
29 | + ) | |
30 | + ) | |
31 | + | |
32 | + if temperature_c is not None and humidity is not None : | |
33 | + urlTemp = 'http://%s:59986/api/v3/resource/Temp_and_Humidity_sensor_cluster_01/temperature' % edgexip | |
34 | + urlHum = 'http://%s:59986/api/v3/resource/Temp_and_Humidity_sensor_cluster_01/humidity' % edgexip | |
35 | + | |
36 | + headers = {'content-type': 'application/json'} | |
37 | + response = requests.post(urlTemp, data=json.dumps(int(temperature_c)), headers=headers,verify=False) | |
38 | + response = requests.post(urlHum, data=json.dumps(int(humidity)), headers=headers,verify=False) | |
39 | + | |
40 | + | |
41 | + | |
42 | + | |
43 | + else: | |
44 | + print('Read error') | |
45 | + time.sleep(100) | |
46 | + | |
47 | + | |
48 | + except RuntimeError as error: | |
49 | + # 오류 발생 시 계속 진행 | |
50 | + print(error.args[0]) | |
51 | + time.sleep(2.0) | |
52 | + continue | |
53 | + except Exception as error: | |
54 | + # 예기치 않은 오류 시 종료 | |
55 | + # dhtDevice.exit() | |
56 | + print("Unexpected error:", error) | |
57 | + sys.exit() | |
58 | + raise error | |
59 | + | |
60 | + time.sleep(2.0) |
+++ edgex/sensorClusterDeviceProfile.yaml
... | ... | @@ -0,0 +1,44 @@ |
1 | +name: "SensorCluster" | |
2 | +manufacturer: "xslab" | |
3 | +model: "VORA-Kit" | |
4 | +labels: | |
5 | +- "temperature" | |
6 | +- "humidity" | |
7 | +description: "Sensor cluster providing metrics for temperature and humidity" | |
8 | + | |
9 | +deviceResources: | |
10 | +- | |
11 | + name: "temperature" | |
12 | + isHidden: false #is hidden is false by default so this is just making it explicit for purpose of the walkthrough demonstration | |
13 | + description: "Sensor cluster temperature values" | |
14 | + properties: | |
15 | + valueType: "Int64" | |
16 | + readWrite: "RW" #designates that this property can only be read and not set | |
17 | + minimum: -50 | |
18 | + maximum: 100 | |
19 | + defaultValue: "0" | |
20 | + attributes: # 프로토콜별 속성 추가 | |
21 | + mqtt-topic: "sensor/temp" | |
22 | + unit: "Celsius" | |
23 | +- | |
24 | + name: "humidity" | |
25 | + isHidden: false | |
26 | + description: "Sensor cluster humidity values" | |
27 | + properties: | |
28 | + valueType: "Int64" | |
29 | + readWrite: "RW" #designates that this property can only be read and not set | |
30 | + minimum: 0 | |
31 | + maximum: 100 | |
32 | + defaultValue: "0" | |
33 | + attributes: # 프로토콜별 속성 추가 | |
34 | + mqtt-topic: "sensor/hum" | |
35 | + unit: "Percent" | |
36 | + | |
37 | +deviceCommands: | |
38 | +- | |
39 | + name: "Counts" | |
40 | + readWrite: "R" | |
41 | + isHidden: false | |
42 | + resourceOperations: | |
43 | + - { deviceResource: "temperature" } | |
44 | + - { deviceResource: "humidity" } |
+++ howto_lib_make
... | ... | @@ -0,0 +1,2 @@ |
1 | +Shared Library 와 Static Library 를 공부하기 위한 Makefile 예제 소스 입니다. | |
2 | + |
+++ k8s/calico.yaml
This file is too big to display. |
+++ k8s/docker-install.sh
... | ... | @@ -0,0 +1,45 @@ |
1 | +#! /bin/bash | |
2 | +# sudo로 실행 필요 | |
3 | +# docker 설치 | |
4 | + | |
5 | +apt-get update | |
6 | +apt-get install -y ca-certificates curl gnupg lsb-release | |
7 | + | |
8 | +install -m 0755 -d /etc/apt/keyrings | |
9 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
10 | +chmod a+r /etc/apt/keyrings/docker.asc | |
11 | + | |
12 | +echo \ | |
13 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
14 | + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
15 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
16 | + | |
17 | +apt-get update | |
18 | +apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
19 | + | |
20 | +# Cgroup를 systemd로 설정 | |
21 | +cat > /etc/docker/daemon.json <<EOF | |
22 | +{ | |
23 | + "exec-opts": ["native.cgroupdriver=systemd"], | |
24 | + "log-driver": "json-file", | |
25 | + "log-opts": { | |
26 | + "max-size": "100m" | |
27 | + }, | |
28 | + "storage-driver": "overlay2" | |
29 | +} | |
30 | +EOF | |
31 | + | |
32 | +mkdir -p /etc/systemd/system/docker.service.d | |
33 | +systemctl daemon-reload | |
34 | +systemctl restart docker | |
35 | +sudo systemctl enable docker | |
36 | + | |
37 | +# 일반유저 Docker 사용 | |
38 | +usermod -aG docker vraptor | |
39 | + | |
40 | +apt-get install -y bash-completion | |
41 | + | |
42 | +curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh | |
43 | + | |
44 | +apt-get install -y docker-compose | |
45 | + |
+++ k8s/influxdb-v2.yaml
... | ... | @@ -0,0 +1,81 @@ |
1 | +apiVersion: v1 | |
2 | +kind: Service | |
3 | +metadata: | |
4 | + name: influxdb | |
5 | +spec: | |
6 | + type: NodePort | |
7 | + selector: | |
8 | + app: influxdb | |
9 | + ports: | |
10 | + - name: web | |
11 | + port: 8086 | |
12 | + protocol: TCP | |
13 | + targetPort: 8086 | |
14 | + nodePort: 30201 | |
15 | +--- | |
16 | +apiVersion: apps/v1 | |
17 | +kind: StatefulSet | |
18 | +metadata: | |
19 | + labels: | |
20 | + app: influxdb | |
21 | + name: influxdb | |
22 | +spec: | |
23 | + serviceName: "influxdb" | |
24 | + replicas: 1 | |
25 | + selector: | |
26 | + matchLabels: | |
27 | + app: influxdb | |
28 | + template: | |
29 | + metadata: | |
30 | + labels: | |
31 | + app: influxdb | |
32 | + spec: | |
33 | + containers: | |
34 | + - name: influxdb | |
35 | + image: registry.xslab.co.kr/lecture/influxdb:2.7.6 | |
36 | + ports: | |
37 | + - name: gui | |
38 | + containerPort: 8086 | |
39 | + volumeMounts: | |
40 | + - name: data | |
41 | + mountPath: /root/.influxdbv2 | |
42 | + volumeClaimTemplates: | |
43 | + - metadata: | |
44 | + name: data | |
45 | + spec: | |
46 | + storageClassName: local-path | |
47 | + accessModes: | |
48 | + - ReadWriteOnce | |
49 | + resources: | |
50 | + requests: | |
51 | + storage: 10Gi | |
52 | +--- | |
53 | +apiVersion: batch/v1 | |
54 | +kind: Job | |
55 | +metadata: | |
56 | + name: influxdb-setup | |
57 | +spec: | |
58 | + template: | |
59 | + spec: | |
60 | + restartPolicy: Never | |
61 | + containers: | |
62 | + - name: create-credentials | |
63 | + image: registry.xslab.co.kr/lecture/influxdb:2.7.6 | |
64 | + command: | |
65 | + - influx | |
66 | + args: | |
67 | + - setup | |
68 | + - --host | |
69 | + - http://influxdb.default.svc.cluster.local:8086 | |
70 | + - --bucket | |
71 | + - xslab-bucket | |
72 | + - --org | |
73 | + - xslab-org | |
74 | + - --password | |
75 | + - xslab1234 | |
76 | + - --username | |
77 | + - xslab | |
78 | + - --token | |
79 | + - xslab-token | |
80 | + - --force | |
81 | + |
+++ k8s/k8s-install-setup.sh
... | ... | @@ -0,0 +1,37 @@ |
1 | +#! /bin/bash | |
2 | +# sudo로 실행 필요 | |
3 | + | |
4 | +# K8s 설치 | |
5 | +# 네트워크 설정 | |
6 | +cat << EOF | sudo tee /etc/modules-load.d/k8s.conf | |
7 | +overlay | |
8 | +br_netfilter | |
9 | +EOF | |
10 | + | |
11 | +modprobe overlay | |
12 | +modprobe br_netfilter | |
13 | + | |
14 | +cat << EOF | sudo tee /etc/sysctl.d/k8s.conf | |
15 | +net.bridge.bridge-nf-call-iptables = 1 | |
16 | +net.bridge.bridge-nf-call-ip6tables = 1 | |
17 | +net.ipv4.ip_forward = 1 | |
18 | +EOF | |
19 | + | |
20 | +sysctl --system | |
21 | + | |
22 | +# Containerd config 수정 | |
23 | +mkdir -p /etc/containerd | |
24 | +containerd config default | sudo tee /etc/containerd/config.toml | |
25 | +sed -i 's/ SystemdCgroup = false/ SystemdCgroup = true/' /etc/containerd/config.toml | |
26 | +sudo systemctl restart containerd | |
27 | + | |
28 | +# K8s 설치 | |
29 | +apt-get update | |
30 | +apt-get install -y apt-transport-https ca-certificates curl | |
31 | +curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | |
32 | +echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
33 | +apt-get update | |
34 | +apt-get install -y kubelet kubeadm kubectl | |
35 | +apt-mark hold kubelet kubeadm kubectl | |
36 | +echo 'source <(kubectl completion bash)' >> /root/.bashrc | |
37 | +kubectl completion bash >/etc/bash_completion.d/kubectl |
+++ k8s/local-path-storage.yaml
... | ... | @@ -0,0 +1,130 @@ |
1 | +apiVersion: v1 | |
2 | +kind: Namespace | |
3 | +metadata: | |
4 | + name: local-path-storage | |
5 | + | |
6 | +--- | |
7 | +apiVersion: v1 | |
8 | +kind: ServiceAccount | |
9 | +metadata: | |
10 | + name: local-path-provisioner-service-account | |
11 | + namespace: local-path-storage | |
12 | + | |
13 | +--- | |
14 | +apiVersion: rbac.authorization.k8s.io/v1 | |
15 | +kind: ClusterRole | |
16 | +metadata: | |
17 | + name: local-path-provisioner-role | |
18 | +rules: | |
19 | + - apiGroups: [ "" ] | |
20 | + resources: [ "nodes", "persistentvolumeclaims", "configmaps" ] | |
21 | + verbs: [ "get", "list", "watch" ] | |
22 | + - apiGroups: [ "" ] | |
23 | + resources: [ "endpoints", "persistentvolumes", "pods" ] | |
24 | + verbs: [ "*" ] | |
25 | + - apiGroups: [ "" ] | |
26 | + resources: [ "events" ] | |
27 | + verbs: [ "create", "patch" ] | |
28 | + - apiGroups: [ "storage.k8s.io" ] | |
29 | + resources: [ "storageclasses" ] | |
30 | + verbs: [ "get", "list", "watch" ] | |
31 | + | |
32 | +--- | |
33 | +apiVersion: rbac.authorization.k8s.io/v1 | |
34 | +kind: ClusterRoleBinding | |
35 | +metadata: | |
36 | + name: local-path-provisioner-bind | |
37 | +roleRef: | |
38 | + apiGroup: rbac.authorization.k8s.io | |
39 | + kind: ClusterRole | |
40 | + name: local-path-provisioner-role | |
41 | +subjects: | |
42 | + - kind: ServiceAccount | |
43 | + name: local-path-provisioner-service-account | |
44 | + namespace: local-path-storage | |
45 | + | |
46 | +--- | |
47 | +apiVersion: apps/v1 | |
48 | +kind: Deployment | |
49 | +metadata: | |
50 | + name: local-path-provisioner | |
51 | + namespace: local-path-storage | |
52 | +spec: | |
53 | + replicas: 1 | |
54 | + selector: | |
55 | + matchLabels: | |
56 | + app: local-path-provisioner | |
57 | + template: | |
58 | + metadata: | |
59 | + labels: | |
60 | + app: local-path-provisioner | |
61 | + spec: | |
62 | + serviceAccountName: local-path-provisioner-service-account | |
63 | + containers: | |
64 | + - name: local-path-provisioner | |
65 | + image: rancher/local-path-provisioner:master-head | |
66 | + imagePullPolicy: IfNotPresent | |
67 | + command: | |
68 | + - local-path-provisioner | |
69 | + - --debug | |
70 | + - start | |
71 | + - --config | |
72 | + - /etc/config/config.json | |
73 | + volumeMounts: | |
74 | + - name: config-volume | |
75 | + mountPath: /etc/config/ | |
76 | + env: | |
77 | + - name: POD_NAMESPACE | |
78 | + valueFrom: | |
79 | + fieldRef: | |
80 | + fieldPath: metadata.namespace | |
81 | + volumes: | |
82 | + - name: config-volume | |
83 | + configMap: | |
84 | + name: local-path-config | |
85 | + | |
86 | +--- | |
87 | +apiVersion: storage.k8s.io/v1 | |
88 | +kind: StorageClass | |
89 | +metadata: | |
90 | + name: local-path | |
91 | +provisioner: rancher.io/local-path | |
92 | +volumeBindingMode: WaitForFirstConsumer | |
93 | +reclaimPolicy: Delete | |
94 | + | |
95 | +--- | |
96 | +kind: ConfigMap | |
97 | +apiVersion: v1 | |
98 | +metadata: | |
99 | + name: local-path-config | |
100 | + namespace: local-path-storage | |
101 | +data: | |
102 | + config.json: |- | |
103 | + { | |
104 | + "nodePathMap":[ | |
105 | + { | |
106 | + "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", | |
107 | + "paths":["/opt/local-path-provisioner"] | |
108 | + } | |
109 | + ] | |
110 | + } | |
111 | + setup: |- | |
112 | + #!/bin/sh | |
113 | + set -eu | |
114 | + mkdir -m 0777 -p "$VOL_DIR" | |
115 | + teardown: |- | |
116 | + #!/bin/sh | |
117 | + set -eu | |
118 | + rm -rf "$VOL_DIR" | |
119 | + helperPod.yaml: |- | |
120 | + apiVersion: v1 | |
121 | + kind: Pod | |
122 | + metadata: | |
123 | + name: helper-pod | |
124 | + spec: | |
125 | + containers: | |
126 | + - name: helper-pod | |
127 | + image: busybox | |
128 | + imagePullPolicy: IfNotPresent | |
129 | + | |
130 | + |
+++ k8s/rabbitmq.yaml
... | ... | @@ -0,0 +1,46 @@ |
1 | +apiVersion: v1 | |
2 | +kind: Service | |
3 | +metadata: | |
4 | + name: rabbitmq | |
5 | +spec: | |
6 | + ports: | |
7 | + - name: mqtt | |
8 | + port: 1883 | |
9 | + protocol: TCP | |
10 | + targetPort: 1883 | |
11 | + nodePort: 30101 | |
12 | + - name: amqp | |
13 | + port: 5672 | |
14 | + protocol: TCP | |
15 | + targetPort: 5672 | |
16 | + nodePort: 30102 | |
17 | + - name: management | |
18 | + port: 15672 | |
19 | + protocol: TCP | |
20 | + targetPort: 15672 | |
21 | + nodePort: 30103 | |
22 | + selector: | |
23 | + app: rabbitmq | |
24 | + type: NodePort | |
25 | +--- | |
26 | +apiVersion: apps/v1 | |
27 | +kind: Deployment | |
28 | +metadata: | |
29 | + name: rabbitmq | |
30 | +spec: | |
31 | + replicas: 1 | |
32 | + selector: | |
33 | + matchLabels: | |
34 | + app: rabbitmq | |
35 | + template: | |
36 | + metadata: | |
37 | + labels: | |
38 | + app: rabbitmq | |
39 | + spec: | |
40 | + containers: | |
41 | + - name: rabbitmq | |
42 | + image: registry.xslab.co.kr/lecture/rabbitmq:3.11.15 | |
43 | + ports: | |
44 | + - containerPort: 1883 | |
45 | + - containerPort: 5672 | |
46 | + - containerPort: 15672 |
+++ k8s/telegraf-v2.yaml
... | ... | @@ -0,0 +1,63 @@ |
1 | +apiVersion: v1 | |
2 | +kind: ConfigMap | |
3 | +metadata: | |
4 | + name: telegraf-config | |
5 | +data: | |
6 | + telegraf.conf: |+ | |
7 | + [[outputs.influxdb_v2]] | |
8 | + urls = ["http://influxdb.default.svc.cluster.local:8086"] | |
9 | + organization = "xslab-org" | |
10 | + bucket = "xslab-bucket" | |
11 | + token = "xslab-token" | |
12 | + | |
13 | + [[inputs.mqtt_consumer]] | |
14 | + servers = ["rabbitmq.default.svc.cluster.local:1883"] | |
15 | + qos = 0 | |
16 | + topics = [ | |
17 | + "temphum" | |
18 | + ] | |
19 | + data_format = "json" | |
20 | +--- | |
21 | +apiVersion: apps/v1 | |
22 | +kind: Deployment | |
23 | +metadata: | |
24 | + name: telegraf | |
25 | +spec: | |
26 | + selector: | |
27 | + matchLabels: | |
28 | + app: telegraf | |
29 | + minReadySeconds: 5 | |
30 | + template: | |
31 | + metadata: | |
32 | + labels: | |
33 | + app: telegraf | |
34 | + spec: | |
35 | + containers: | |
36 | + - image: registry.xslab.co.kr/lecture/telegraf:1.30.3 | |
37 | + name: telegraf | |
38 | + ports: | |
39 | + - containerPort: 8125 | |
40 | + name: telegraf | |
41 | + volumeMounts: | |
42 | + - name: telegraf-config-volume | |
43 | + mountPath: /etc/telegraf/telegraf.conf | |
44 | + subPath: telegraf.conf | |
45 | + readOnly: true | |
46 | + volumes: | |
47 | + - name: telegraf-config-volume | |
48 | + configMap: | |
49 | + name: telegraf-config | |
50 | +--- | |
51 | +apiVersion: v1 | |
52 | +kind: Service | |
53 | +metadata: | |
54 | + name: telegraf | |
55 | +spec: | |
56 | + ports: | |
57 | + - name: telegraf | |
58 | + port: 8125 | |
59 | + targetPort: 8125 | |
60 | + nodePort: 30202 | |
61 | + selector: | |
62 | + app: telegraf | |
63 | + type: NodePort |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?