Trouble connecting to AMQP adapter in OpenShift

93 Views Asked by At

I'm trying to create an MQTT Protocol Gateway for our Hono Cluster running in OpenShift using this template but I am having trouble connecting to the AMQP adapter.

I can connect to the Sandbox AMQP adapter using the CLI (version 2.1.0) but when I try to connect to the instance running in our cluster I get "503 - Temporary unavailable".

enter image description here

I have tried many variants of this command, but I discovered I get the exact same error seemingly no matter what host I call in OpenShift, including hosts not even running in our Hono cluster, and I don't know what that means.

I have verified the cluster installation in so far that all the pods look healthy and I have been able to create tenants and devices and I can send telemetry to the HTTP adapter.

SERVICES $ oc get service
NAME                                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
hono-poc-adapter-amqp                  ClusterIP   172.30.197.58            5672/TCP,5671/TCP            17d
hono-poc-adapter-http                  ClusterIP   172.30.212.47            8080/TCP,8443/TCP            17d
hono-poc-adapter-mqtt                  ClusterIP   172.30.2.192             1883/TCP,8883/TCP            17d
hono-poc-kafka                         ClusterIP   172.30.252.145           9092/TCP                     17d
hono-poc-kafka-0-external              NodePort    172.30.145.109           9094:32094/TCP               17d
hono-poc-kafka-headless                ClusterIP   None                     9092/TCP,9093/TCP            17d
hono-poc-monogodb-server               ClusterIP   172.30.53.142            27017/TCP                    17d
hono-poc-service-auth                  ClusterIP   172.30.226.82            5671/TCP,8088/TCP            17d
hono-poc-service-command-router        ClusterIP   172.30.93.170            5671/TCP                     17d
hono-poc-service-device-registry       ClusterIP   172.30.217.54            5671/TCP,8080/TCP,8443/TCP   17d
hono-poc-service-device-registry-ext   ClusterIP   172.30.170.109           28080/TCP,28443/TCP          17d
hono-poc-zookeeper                     ClusterIP   172.30.176.187           2181/TCP,2888/TCP,3888/TCP   17d
hono-poc-zookeeper-headless            ClusterIP   None                     2181/TCP,2888/TCP,3888/TCP   17d

ROUTES enter image description here

Values overridden in initial helm install:

platform: openshift

kafka:
  podSecurityContext:
    enabled: false
  containerSecurityContext:
    enabled: false

  zookeeper:
    podSecurityContext:
      enabled: false
    containerSecurityContext:
      enabled: false

useLoadBalancer: false

deviceRegistryExample:
  type: "mongodb"
  externalAccess:
    enabled: true

mongoDBBasedDeviceRegistry:
  externalAccess:
    enabled: true

mongodb:
  createInstance: true
  persistence:
    enabled: false

kafka:
  externalAccess:
    autoDiscovery:
      enabled: false
    service:
      type: "NodePort"
      # length of the array must match replicaCount
      nodePorts:
      - "32094"
  serviceAccount:
    create: false
  rbac:
    create: false

adapters:
  amqp:
    enabled: true
  coap:
    enabled: false
  http:
    enabled: true
  mqtt:
    enabled: true
  lora:
    enabled: false
enter code here
2

There are 2 best solutions below

5
On

You should omit the https:// prefix from the host name and you will also need to provide a username and password for authenticating to the AMQP adapter using the -u and -p options:

java -jar hono-cli-*-exec.jar amqp -H hono-poc-adapter... -P 5672 -u sensor1@DEFAULT_TENANT -p hono-secret
0
On

I have still not been able to connect using the CLI from my local computer, but since the protocol gateway should run in the cluster anyway I deployed a container with the Hono CLI installed and ran the CLI from the pods terminal, which worked.

java -jar hono-cli-*-exec.jar amqp -H hono-adapter-amqp -P 5672 -u TEST_DEVICE@TEST_TENANT -p pwd

"hono-adapter-amqp" in this case is the service name of the amqp-adapter in OpenShift, the IP also worked but the route did not.