How to resolve Mosquitto issue of protocol error - mqtt

I have installed mosquitto in Ubuntu18.04
mosquitto version 2.0.14
mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
See https://mosquitto.org/ for more information.
Below is the content of mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
Below is the content of bridge.conf
connection iothub-bridge
log_type all
address ripe.azure-devices.net:8883
remote_username ripe.azure-devices.net/T45
remote_password SharedAccessSignature sr=ripe.azure-devices.net&sig=V0ydOeJN3UHpD1l63kyz%2Bj0ks8XvZR1YDlBvqQK4a4Q%3D&se=253402280999.23&skn=iothubowner
remote_clientid T45
bridge_cafile /etc/ssl/certs/ca-certificates.crt
try_private false
cleansession false
start_type automatic
bridge_insecure false
bridge_protocol_version mqttv311
bridge_tls_version tlsv1.2
notifications false
keepalive_interval 36000
autosave_interval 30
topic # out 2 devices/T45/messages/events/ devices/T45/messages/events/
topic # in 2 devices/T45/messages/devicebound/ devices/T45/messages/devicebound/
In the logs I can see
Client local.T45 disconnected: Protocol error.
What does this error means and how can I resolve it? Please help. Thanks
Below are the logs from /var/log/mosquitto/mosquitto.log where exactly at 1644460186 you can notice protocol error (I have put spaces between line to make it more appearing)
1644460056: mosquitto version 2.0.14 starting
1644460056: Config loaded from /etc/mosquitto/mosquitto.conf.
1644460056: Starting in local only mode. Connections will only be possible from clients running on this machine.
1644460056: Create a configuration file which defines a listener to allow remote access.
1644460056: For more details see https://mosquitto.org/documentation/authentication-methods/
1644460056: Opening ipv4 listen socket on port 1883.
1644460056: Opening ipv6 listen socket on port 1883.
1644460056: Bridge local.T45 doing local SUBSCRIBE on topic devices/T45/messages/events/#
1644460056: Connecting bridge (step 1) iothub-bridge_1 (ripe.azure-devices.net:8883)
1644460056: mosquitto version 2.0.14 running
1644460056: Connecting bridge (step 2) iothub-bridge_1 (ripe.azure-devices.net:8883)
1644460056: Bridge T45 sending CONNECT
1644460057: New connection from 127.0.0.1:41643 on port 1883.
1644460057: New client connected from 127.0.0.1:41643 as Sender (p2, c1, k60).
1644460057: No will message specified.
1644460057: Sending CONNACK to Sender (0, 0)
1644460057: New connection from 127.0.0.1:56081 on port 1883.
1644460057: New client connected from 127.0.0.1:56081 as GateWay-1 (p2, c1, k120).
1644460057: No will message specified.
1644460057: Sending CONNACK to GateWay-1 (0, 0)
1644460057: Received SUBSCRIBE from Sender
1644460057: raspberry/zigbee (QoS 0)
1644460057: Sender 0 raspberry/zigbee
1644460057: Sending SUBACK to Sender
1644460086: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1644460086: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460086: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460086: New connection from 127.0.0.1:41721 on port 1883.
1644460086: New client connected from 127.0.0.1:41721 as auto-A6AC5150-859B-6481-F115-F5A4E2A78E38 (p2, c1, k60).
1644460086: No will message specified.
1644460086: Sending CONNACK to auto-A6AC5150-859B-6481-F115-F5A4E2A78E38 (0, 0)
1644460086: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460086: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460086: Received PUBLISH from auto-A6AC5150-859B-6481-F115-F5A4E2A78E38 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (496 bytes))
1644460086: Sending PUBACK to auto-A6AC5150-859B-6481-F115-F5A4E2A78E38 (m1, rc0)
1644460086: Received DISCONNECT from auto-A6AC5150-859B-6481-F115-F5A4E2A78E38
1644460086: Client auto-A6AC5150-859B-6481-F115-F5A4E2A78E38 disconnected.
1644460086: New connection from 127.0.0.1:39873 on port 1883.
1644460086: New client connected from 127.0.0.1:39873 as auto-AF07BB04-B557-4BF2-D493-CBF76F405156 (p2, c1, k60).
1644460086: No will message specified.
1644460086: Sending CONNACK to auto-AF07BB04-B557-4BF2-D493-CBF76F405156 (0, 0)
1644460086: Received PUBLISH from auto-AF07BB04-B557-4BF2-D493-CBF76F405156 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460086: Sending PUBACK to auto-AF07BB04-B557-4BF2-D493-CBF76F405156 (m1, rc0)
1644460086: Received DISCONNECT from auto-AF07BB04-B557-4BF2-D493-CBF76F405156
1644460086: Client auto-AF07BB04-B557-4BF2-D493-CBF76F405156 disconnected.
1644460100: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460100: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460100: New connection from 127.0.0.1:38321 on port 1883.
1644460100: New client connected from 127.0.0.1:38321 as auto-35DA741A-5DF9-2344-E252-8ED90D074794 (p2, c1, k60).
1644460100: No will message specified.
1644460100: Sending CONNACK to auto-35DA741A-5DF9-2344-E252-8ED90D074794 (0, 0)
1644460100: Received PUBLISH from auto-35DA741A-5DF9-2344-E252-8ED90D074794 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460100: Sending PUBACK to auto-35DA741A-5DF9-2344-E252-8ED90D074794 (m1, rc0)
1644460100: Received DISCONNECT from auto-35DA741A-5DF9-2344-E252-8ED90D074794
1644460100: Client auto-35DA741A-5DF9-2344-E252-8ED90D074794 disconnected.
1644460103: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460103: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460103: New connection from 127.0.0.1:40241 on port 1883.
1644460103: New client connected from 127.0.0.1:40241 as auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F (p2, c1, k60).
1644460103: No will message specified.
1644460103: Sending CONNACK to auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F (0, 0)
1644460103: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460103: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460103: Received PUBLISH from auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (496 bytes))
1644460103: Sending PUBACK to auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F (m1, rc0)
1644460103: Received DISCONNECT from auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F
1644460103: Client auto-748D1EFE-8960-472B-D381-6EEC8AC4FF2F disconnected.
1644460103: New connection from 127.0.0.1:58641 on port 1883.
1644460103: New client connected from 127.0.0.1:58641 as auto-BCD5D50F-D690-16D0-3780-D3C12004407B (p2, c1, k60).
1644460103: No will message specified.
1644460103: Sending CONNACK to auto-BCD5D50F-D690-16D0-3780-D3C12004407B (0, 0)
1644460103: Received PUBLISH from auto-BCD5D50F-D690-16D0-3780-D3C12004407B (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460103: Sending PUBACK to auto-BCD5D50F-D690-16D0-3780-D3C12004407B (m1, rc0)
1644460103: Received DISCONNECT from auto-BCD5D50F-D690-16D0-3780-D3C12004407B
1644460103: Client auto-BCD5D50F-D690-16D0-3780-D3C12004407B disconnected.
1644460116: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460116: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460116: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (369 bytes))
1644460116: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (369 bytes))
1644460116: New connection from 127.0.0.1:50139 on port 1883.
1644460116: New client connected from 127.0.0.1:50139 as auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7 (p2, c1, k60).
1644460116: No will message specified.
1644460116: Sending CONNACK to auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7 (0, 0)
1644460116: Received PUBLISH from auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (496 bytes))
1644460116: Sending PUBACK to auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7 (m1, rc0)
1644460116: Received DISCONNECT from auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7
1644460116: Client auto-BBCFAC32-DD66-649D-ECD9-C428AC01DCA7 disconnected.
1644460116: New connection from 127.0.0.1:59883 on port 1883.
1644460116: New client connected from 127.0.0.1:59883 as auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A (p2, c1, k60).
1644460116: No will message specified.
1644460116: Sending CONNACK to auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A (0, 0)
1644460116: Received PUBLISH from auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460116: Sending PUBACK to auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A (m1, rc0)
1644460116: Received DISCONNECT from auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A
1644460116: Client auto-5ED9ADF5-E029-1CBB-C86E-11129A40653A disconnected.
1644460117: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1644460118: Received PINGREQ from Sender
1644460118: Sending PINGRESP to Sender
1644460146: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (162 bytes))
1644460146: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (162 bytes))
1644460146: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460146: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460146: New connection from 127.0.0.1:55549 on port 1883.
1644460146: New client connected from 127.0.0.1:55549 as auto-DA933222-650B-4F6B-7C1A-FC44C9301551 (p2, c1, k60).
1644460146: No will message specified.
1644460146: Sending CONNACK to auto-DA933222-650B-4F6B-7C1A-FC44C9301551 (0, 0)
1644460146: Received PUBLISH from auto-DA933222-650B-4F6B-7C1A-FC44C9301551 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (495 bytes))
1644460146: Sending PUBACK to auto-DA933222-650B-4F6B-7C1A-FC44C9301551 (m1, rc0)
1644460146: Received DISCONNECT from auto-DA933222-650B-4F6B-7C1A-FC44C9301551
1644460146: Client auto-DA933222-650B-4F6B-7C1A-FC44C9301551 disconnected.
1644460146: New connection from 127.0.0.1:51399 on port 1883.
1644460146: New client connected from 127.0.0.1:51399 as auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D (p2, c1, k60).
1644460146: No will message specified.
1644460146: Sending CONNACK to auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D (0, 0)
1644460146: Received PUBLISH from auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460146: Sending PUBACK to auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D (m1, rc0)
1644460146: Received DISCONNECT from auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D
1644460146: Client auto-678EC03F-ABB6-CA64-00DB-BDD47F57337D disconnected.
1644460148: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1644460161: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460161: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460161: New connection from 127.0.0.1:40109 on port 1883.
1644460161: New client connected from 127.0.0.1:40109 as auto-E898C4CD-622A-1271-CFBE-242783E578EC (p2, c1, k60).
1644460161: No will message specified.
1644460161: Sending CONNACK to auto-E898C4CD-622A-1271-CFBE-242783E578EC (0, 0)
1644460161: Received PUBLISH from auto-E898C4CD-622A-1271-CFBE-242783E578EC (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460161: Sending PUBACK to auto-E898C4CD-622A-1271-CFBE-242783E578EC (m1, rc0)
1644460161: Received DISCONNECT from auto-E898C4CD-622A-1271-CFBE-242783E578EC
1644460161: Client auto-E898C4CD-622A-1271-CFBE-242783E578EC disconnected.
1644460176: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460176: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (163 bytes))
1644460176: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (369 bytes))
1644460176: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (369 bytes))
1644460176: New connection from 127.0.0.1:45683 on port 1883.
1644460176: New client connected from 127.0.0.1:45683 as auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3 (p2, c1, k60).
1644460176: No will message specified.
1644460176: Sending CONNACK to auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3 (0, 0)
1644460176: Received PUBLISH from auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3 (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (496 bytes))
1644460176: Sending PUBACK to auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3 (m1, rc0)
1644460176: Received DISCONNECT from auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3
1644460176: Client auto-416D5585-0094-6CA2-5EC5-FBDC14A440D3 disconnected.
1644460176: New connection from 127.0.0.1:44277 on port 1883.
1644460176: New client connected from 127.0.0.1:44277 as auto-C39DB933-9085-5256-90ED-8ADB846CFE7C (p2, c1, k60).
1644460176: No will message specified.
1644460176: Sending CONNACK to auto-C39DB933-9085-5256-90ED-8ADB846CFE7C (0, 0)
1644460176: Received PUBLISH from auto-C39DB933-9085-5256-90ED-8ADB846CFE7C (d0, q1, r0, m1, 'devices/T45/messages/events/', ... (325 bytes))
1644460176: Sending PUBACK to auto-C39DB933-9085-5256-90ED-8ADB846CFE7C (m1, rc0)
1644460176: Received DISCONNECT from auto-C39DB933-9085-5256-90ED-8ADB846CFE7C
1644460176: Client auto-C39DB933-9085-5256-90ED-8ADB846CFE7C disconnected.
1644460177: Received PINGREQ from GateWay-1
1644460177: Sending PINGRESP to GateWay-1
1644460178: Received PINGREQ from Sender
1644460178: Sending PINGRESP to Sender
1644460179: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1644460186: Client local.T45 disconnected: Protocol error.
1644460194: Bridge local.T45 doing local SUBSCRIBE on topic devices/T45/messages/events/#
1644460194: Connecting bridge (step 1) iothub-bridge_1 (ripe.azure-devices.net:8883)
1644460195: Connecting bridge (step 2) iothub-bridge_1 (ripe.azure-devices.net:8883)
1644460195: Bridge T45 sending CONNECT
1644460205: Received PUBLISH from GateWay-1 (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460205: Sending PUBLISH to Sender (d0, q0, r0, m0, 'raspberry/zigbee', ... (368 bytes))
1644460205: New connection from 127.0.0.1:46557 on port 1883.
1644460205: New client connected from 127.0.0.1:46557 as auto-B4334155-551F-34B4-2214-66DFF50D4F5C (p2, c1, k60).
1644460205: No will message specified.

Related

mosquitto_sub and Tuya TS0601 TRV

Is it possible to send settings to a TS0601 TRV from MQTT?
For example:
# mosquitto_pub -h localhost -t Home/Bed3/Radiator/set/force -m "open" -d
Client mosqpub|19143-mini31 sending CONNECT
Client mosqpub|19143-mini31 received CONNACK (0)
Client mosqpub|19143-mini31 sending PUBLISH (d0, q0, r0, m1, 'Home/Bed3/Radiator/set/force', ... (4 bytes))
Client mosqpub|19143-mini31 sending DISCONNECT
but nothing happens.
I can see my sent messages appearing in
# mosquitto_sub -h localhost -t Home/Bed3/Radiator/# -v

Mosquitto bridge broker, connection refused after connecting

I'm developing a webapp that connects to a local broker (dyson), the problem is that I can't directly connect to MQTT protocol directly from browser, and I cant edit the dyson broker config to open websockets ports. So Im creating a new broker with open websockets bridged to the dyson broker. I've tested direct access via server MQTT to dyson and works well, I can retrieve data from it. But when I try to connect from my broker it connects and then throws connection refused.
This is my broker config:
listener 9001
protocol websockets
allow_anonymous true
listener 1883
protocol mqtt
allow_anonymous true
connection paho33095379815290
address 10.0.0.248:1883
remote_clientid paho33095379815290
remote_username VS9-EU-233232A
remote_password ******
bridge_protocol_version mqttv311
cleansession true
try_private false
topic # both 0
log_type all
this are the logs i get:
135848336: Bridge local.paho33095379815290 doing local SUBSCRIBE on topic #
135848336: Connecting bridge (step 1) paho33095379815290 (10.0.0.248:1883)
135848336: Connecting bridge (step 2) paho33095379815290 (10.0.0.248:1883)
135848336: Bridge paho33095379815290 sending CONNECT
135848336: Received CONNACK on connection local.paho33095379815290.
135848336: Connection Refused: broker unavailable
Ok, so basically this is the final mosquitto config:
log_type all
listener 9001
protocol websockets
allow_anonymous true
listener 1883
protocol mqtt
allow_anonymous true
#bridge
connection dyson-fan
address 10.0.0.248:1883
remote_clientid paho33135379815290
remote_username VS9-EU-KFA2511A
remote_password *****
bridge_protocol_version mqttv311
try_private false
notifications false
cleansession true
topic # both 0
For some reason, notifications to default true, which was making the Dyson broker unavailable.

MQTT Broker does not receive any messages

I'm trying to connect my Tasmota switch over mqtt. i have installed mosquitto on a virtual machine, heres the configuration:
/etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
/etc/mosquitto/acl
# weewx readwrite to the loop
user tasmota
#topic weather/#
/etc/mosquitto/conf.d/myconfig.conf
allow_anonymous true
password_file /etc/mosquitto/passwd
persistence false
protocol mqtt
acl_file /etc/mosquitto/acl
the service is running, and the port is up
this is the configuration of my switch
im trying to take a look at messages with
mosquitto_sub -h 10.11.0.106 -t '#'
also tried to add user and password, but i dont get any output
i can see in the log, that the connection is established
1579896351: Config loaded from /etc/mosquitto/mosquitto.conf.
1579896351: Opening ipv4 listen socket on port 1883.
1579896351: Opening ipv6 listen socket on port 1883.
1579896351: New connection from 10.10.0.137 on port 1883.
1579896351: New client connected from 10.10.0.137 as mosqsub|19705-warmachin (c1, k60).
1579896358: Socket error on client mosqsub|19705-warmachin, disconnecting.
1579896358: New connection from 10.10.0.137 on port 1883.
1579896358: New client connected from 10.10.0.137 as mosqsub|19775-warmachin (c1, k60).
1579896361: New connection from 10.11.1.51 on port 1883.
1579896361: New client connected from 10.11.1.51 as DVES_6CA231 (c1, k30, u'tasmota').
1579896361: New connection from 10.11.1.52 on port 1883.
1579896361: New client connected from 10.11.1.52 as DVES_301DDC (c1, k30, u'tasmota').
1579896362: New connection from 10.11.1.54 on port 1883.
1579896362: New client connected from 10.11.1.54 as DVES_350992 (c1, k30, u'tasmota').
did i miss something or am i missunderstanding something completely wrong?
please help
As thrashed out in the comments, your ACL file is missing any enabled topics either for the anonymous user or the tasmota user.
If you enable ACLs you need to define all the topics you want users to be able to access.

Debugging DNS resolutions in kubernetes

I have initialized kubernetes v1.13.1 cluster on Ubuntu 16.04 using below command:
sudo kubeadm init --token-ttl=0 --apiserver-advertise-address=192.168.88.142
and installed weave using:
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
I have 10 raspberry pi acting as worker nodes and connected to the cluster. All of them are running the deployment fine. There nodes are running pods which try to connect to iot hub visdwk-azure-devices.net and publish some data. Out of 10 nodes, only few nodes are able to connect and other throws error unable to connect to iot hub. I did a ping test and found out that they were not able to ping google while they were pinging the public IP address of google.
This made me think that something is wrong with the coredns pod. I followed this documentation and did below test.
Pod has below contents in /etc/resolv.conf
nameserver 10.96.0.10
search visdwk.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
which looks normal to me. All the coredns pods are running fine.
coredns-86c58d9df4-42xqc 1/1 Running 8 1d11h
coredns-86c58d9df4-p6d98 1/1 Running 7 1d6h
I have also done nslookup kubernetes.default from the busybox container and got the proper response. Below are the logs of coredns-86c58d9df4-42xqc
.:53
2019-02-08T08:40:10.038Z [INFO] CoreDNS-1.2.6
2019-02-08T08:40:10.039Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
[INFO] plugin/reload: Running configuration MD5 =
f65c4821c8a9b7b5eb30fa4fbc167769
t
Above logs also looks normal.
I can also not say that the pod is not able to resolve the iot hub because of any error from weave because if weave is throwing error then I believe the pod will never start and will always be in failed state but in actual the pod remains in running state. Please correct me here if I am wrong.
DNS service also seems to be in running state:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 1d6h
But still I am not able to figure out as to why few nodes in the cluster are not able to resolve the iot hub. Can anyone please give me some suggestions here. Please help. Thanks.
Logs from failed pod:
1550138544: New connection from 127.0.0.1 on port 1883.
1550138544: New client connected from 127.0.0.1 as 6f1e2c4f-c44d-4c27-b9a9-0fb91f816504 (c1, k60).
1550138544: Sending CONNACK to 6f1e2c4f-c44d-4c27-b9a9-0fb91f816504 (0, 0)
1550138544: Received PUBLISH from 6f1e2c4f-c44d-4c27-b9a9-0fb91f816504 (d0, q0, r0, m0, 'devices/machine6/messages/events/', ... (1211 bytes))
1550138544: Received DISCONNECT from 6f1e2c4f-c44d-4c27-b9a9-0fb91f816504
1550138544: Client 6f1e2c4f-c44d-4c27-b9a9-0fb91f816504 disconnected.
1550138547: Saving in-memory database to /mqtt/data/mosquitto.db.
1550138547: Bridge local.machine6 doing local SUBSCRIBE on topic devices/machine6/messages/events/#
1550138547: Connecting bridge iothub-bridge (visdwk.azure-devices.net:8883)
1550138552: Error creating bridge: Try again.
1550138566: New connection from 127.0.0.1 on port 1883.
1550138566: New client connected from 127.0.0.1 as afb6cc2a-ee78-482e-aff0-fc595e06f86a (c1, k60).
1550138566: Sending CONNACK to afb6cc2a-ee78-482e-aff0-fc595e06f86a (0, 0)
1550138566: Received PUBLISH from afb6cc2a-ee78-482e-aff0-fc595e06f86a (d0, q0, r0, m0, 'devices/machine6/messages/events/', ... (1211 bytes))
1550138566: Received DISCONNECT from afb6cc2a-ee78-482e-aff0-fc595e06f86a
1550138566: Client afb6cc2a-ee78-482e-aff0-fc595e06f86a disconnected.
1550138567: New connection from 127.0.0.1 on port 1883.
1550138567: New client connected from 127.0.0.1 as 01b9e135-fbc8-4d67-9962-356e8cf9f080 (c1, k60).
1550138567: Sending CONNACK to 01b9e135-fbc8-4d67-9962-356e8cf9f080 (0, 0)
1550138567: Received PUBLISH from 01b9e135-fbc8-4d67-9962-356e8cf9f080 (d0, q0, r0, m0, 'devices/machine6/messages/events/', ... (755 bytes))
1550138567: Received DISCONNECT from 01b9e135-fbc8-4d67-9962-356e8cf9f080
1550138567: Client 01b9e135-fbc8-4d67-9962-356e8cf9f080 disconnected.
1550138578: Saving in-memory database to /mqtt/data/mosquitto.db.
1550138583: Bridge local.machine6 doing local SUBSCRIBE on topic devices/machine6/messages/events/#
1550138583: Connecting bridge iothub-bridge (visdwk.azure-devices.net:8883)
1550138588: Error creating bridge: Try again.
Pod is running a mosquitto container which try to connect to visdwk.azure-devices.net and throws error.
Connecting bridge iothub-bridge (visdwk.azure-devices.net:8883)
Error creating bridge: Try again.
It would appear that one of your DNS Pods is not providing DNS services.
The evidence is is in the statement that "only few nodes are able to connect and other throws error unable to connect to iot hub"
This is a classic symptom of load-balancing with a failed node in the loop.
Try:
Remove the DNS server pod that gave the message: visdwk.azure-devices.net.visdwknamespace.svc.cluster.local. udp 82 false 512" NXDOMAIN qr,aa,rd,ra 175 0.000651078s where visdwk.azure-devices.net
Wait for the changes to propagate through the cluster.
Test the connections.
If this is correct they should all connect.
To confirm, add the pod back and remove the other one. Retest, they should all fail to connect.

Secure bridge between a local mosquito and Watson-iot

I need your help on the MQTT bridging. Currently I can successfully bridge the local MQTT to the Watson IOT messaging, but only in inscure mode, ie. 1883 port. So I got the server certificate by this command
openssl s_client -connect myorg.messaging.internetofthings.ibmcloud.com:8883 -showcerts > server.crt
and removed two lines from the top and two lines from the bottom. When I try to connect this in a secure mode, I get the socket error as below. Could anyone help me on this?
mosquitto.conf
connection bridge-to-watsoniot
bridge_insecure false
bridge_certfile /home/pi/server.crt
address myorg.messaging.internetofthings.ibmcloud.com:8883
cleansession false
try_private false
bridge_attempt_unsubscribe false
notifications true
notification_topic iot-2/type/Raspberry/id/my_mqtt_gateway/evt/status/fmt/raw
remote_username use-token-auth
remote_password ***************
remote_clientid g:myorg:Raspberry:my_mqtt_gateway
topic iot-2/type/+/id/+/cmd/+/fmt/+ in iot-2/type/+/id/+/cmd/+/fmt/+
topic iot-2/type/+/id/+/evt/+/fmt/+ out iot-2/type/+/id/+/evt/+/fmt/+
connection_messages true
mosqutto.log
1487240737: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100) starting
1487240737: Config loaded from mosquitto.conf.
1487240737: Opening ipv4 listen socket on port 1883.
1487240737: Opening ipv6 listen socket on port 1883.
1487240737: Connecting bridge bridge-to-watsoniot (myorg.messaging.internetofthings.ibmcloud.com:8883)
1487240738: New connection from 127.0.0.1 on port 1883.
1487240738: New client connected from 127.0.0.1 as mqttjs_93a3961c (c1, k10, u'foo').
1487240738: New connection from 127.0.0.1 on port 1883.
1487240738: New client connected from 127.0.0.1 as mqttjs_618c88ab (c1, k10).
1487240739: Socket error on client local.g:myorg:Raspberry:my_mqtt_gateway, disconnecting.
1487240747: New connection from 192.168.82.130 on port 1883.
The bridge_certfile directive is for a client side certificate for the local broker to use to authenticate it's self with the remote broker. You should not need to this to connect to Watson IoT.
You should be using the bridge_cafile or bridge_capath to point to a the CA certificate that signed the Watson IoT certificate so the local broker can verify that the remote end is who they say they are.

Resources