<p>I need to run kubemq cluster on my desktop for development. I have installed kubemq docker container as described here <a href="https://docs.kubemq.io/installation/docker.html" rel="nofollow noreferrer">https://docs.kubemq.io/installation/docker.html</a>. But I can't figure out how to connect to it using kubemqctl utility? Is it possible in general? It shows only kubernetes clusters from kubectl config. And I don't see the way how to pass connection information. Thanks. </p>

<p>update #1</p>

<p>after following installation instructions, I see only those cluster which is working in kubernetes cluster and listed in my kubectl config. </p>

<pre><code>Getting KubeMQ Cluster List...
Current Kubernetes cluster context connection: gke_xxxxx_us-central1-a_xxxx
NAME            DESIRED  RUNNING  READY  IMAGE                 AGE          SERVICES
env-dev/kubemq  3        3        3      kubemq/kubemq:latest  1792h54m57s  ClusterIP 10.0.2.211:8080,50000,9090,5228
</code></pre>

<p>when I try to switch conext it shows only that cluster again</p>

<pre><code>Current Kubernetes cluster context connection: gke_xxxxx_us-central1-a_xxxx ? Select kubernetes cluster context  [Use arrows to move, type to filter, ? for more help]
&gt; gke_xxxxx_us-central1-a_xxxx
</code></pre>

<p>My .kubemqctl.yaml content is:</p>

<pre><code>autointegrated: false
currentnamespace: kubemq
currentstatefulset: kubemq-cluster
host: localhost
grpcport: 50000
restport: 9090
apiport: 8080
issecured: false
certfile: ""
kubeconfigpath: ""
connectiontype: grpc
defaulttoken: XXXXXX-ed0c-4077-9a74-b53805ee3214
</code></pre>

<p>update #2</p>

<p>I am able to connect from my go code, to my locally running kubemq cluster</p>

<pre><code>archi@eagle:~/prj/kubemq-go/examples/rpc/command$ docker container ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                      NAMES
3cd60e4373e4        kubemq/kubemq       "./kubemq-run"      46 hours ago        Up 46 hours         0.0.0.0:8080-&gt;8080/tcp, 0.0.0.0:9090-&gt;9090/tcp, 0.0.0.0:50000-&gt;50000/tcp   modest_wescoff
</code></pre>

<p>But I cannot figure out how it is possible to connect to it using kubemq utility, because it does looking once to my kubectl config which cannot contain my local kubemq cluster, running in docker container, not kubernetes cluster. To list my kubemq clusters I use command:  </p>

<pre><code>kubemqctl cluster get
</code></pre>

<p>the  output of the command  is shown above (in update #1 section of my question) </p>

<p>update #3</p>

<p>As @mario said. I am able to attach to my queries channel and see all messages! </p>

<pre><code>$kubemqctl queries attach userservice_channel
Adding 'userservice_channel' to attach list
[queries]  [userservice_channel]  kubemq-3cd60e4373e4 Server connected.
[queries]  [userservice_channel]  { "Kind": "request", "ID": "user_token_validate", "Channel": "userservice_channel", "ReplyChannel": "_INBOX.OYnfIQX2k7V9hTmevxHApp.Iqfr3HUw", "Metadata": "some-metadata", "Body": "\n\ufffd\u0001eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoxLCJyb2xlIjoic3VwZXJ1c2Vy....... 
</code></pre>

Testobile Testossimo
<p>I assume you've already installed <strong>kubemqctl</strong> command following <a href="https://docs.kubemq.io/kubemqctl/kubemqctl.html" rel="nofollow noreferrer">this</a> instruction but you probably haven't configured it yet.</p>
<p>Once you run <code>kubemqctl help</code> command, it will show you all available options including:</p>
<pre><code>Usage:
  kubemqctl [command]

Available Commands:
  cluster      Executes KubeMQ cluster management commands
  commands     Execute KubeMQ 'commands' RPC commands
  config       Run Kubemqctl configuration wizard command
</code></pre>
<p>First you need to run <code>kubemqctl config</code> which will start the <strong>configuration wizard</strong>, guiding you step by step through the basic configuration:</p>
<p>In second step you should select (using arrow keys) your <code>Local docker container</code>:</p>
<pre><code>? Set Default KubeMQ Token (press Enter for default): 
? Select KubeMQ install location:  [Use arrows to move, type to filter, ? for more help]
  Kubernetes cluster
  MicroK8s
  K3s
  Minikube
  Other Kubernetes distribution
&gt; Local docker container
</code></pre>
<p>Other options you can probably left at their defaults.</p>
<p>I assume you already checked that your <strong>KubeMQ</strong> is up and running and its API is available with:</p>
<pre><code>curl --location --request GET &quot;http://localhost:8080/health&quot; \
  --header &quot;Content-Type: application/json&quot;
</code></pre>
<p>If so, you should be able to interact with it using your <code>kubemqctl</code> command line tool.</p>
<p>Please let me know if it helps.</p>
<hr />
<h3>Update:</h3>
<p><code>kubemqctl config</code> is merely a <code>wizard</code> tool which creates your <code>.kubemqctl.yaml</code> file based on which you can run <code>kubemqctl commands</code> against your <code>kubemq</code> instance. My <code>.kubemqctl.yaml</code> looks exactly the same as yours (only with different token).</p>
<p>As I already mentioned in my comment, <strong>single docker container isn't considered a cluster at all</strong>. From <strong>kubernetes</strong> perspective it is merely a container runtime and it is totally normal that <code>kubemqctl</code> similarly to <code>kubectl</code> will not list it as a <code>cluster</code> and won't be able to perform on it any cluster-related operation such as <code>kubemqctl cluster get</code>. You can easily verify it by changing your .kube/config name:</p>
<pre><code>mv .kube/config .kube/config_temporarily_disabled
</code></pre>
<p>If I run <code>kubemqctl cluster get</code> now, it shows me the following output:</p>
<pre><code>Getting KubeMQ Cluster List...
Error: Kubernetes Config File: Stat &lt;path_to_the_kube_config_file&gt;: No Such File Or Directory
</code></pre>
<p>which means that <code>kubemqctl</code> similarly to <code>kubectl</code> always looks for <code>kubeconfig</code> file when performing any <code>cluster-related</code> operation. This group of <code>kubemqctl</code> commands is simply designed only for this purpose and is not intended to be used with your <code>kubemq</code> instance deployed as a single docker container following <a href="https://docs.kubemq.io/installation/docker.html" rel="nofollow noreferrer">this</a> instruction.</p>
<h3><strong>Important:</strong> single docker container <strong>IS NOT</strong> a cluster</h3>
<p>It is not a cluster both in common sense and it is not considered as such by <code>kubemqctl</code> utility.</p>
<p>Note that you didn't even create it with:</p>
<pre><code>kubemqctl cluster create -t &lt;YOUR_KUBEMQ_TOKEN&gt;
</code></pre>
<p>which is used to create a <code>cluster</code> in all <strong>kubernetes-based</strong> solutions described in the <a href="https://docs.kubemq.io/installation/kubernetes.html" rel="nofollow noreferrer">documentation</a>: <strong>Kubernetes, MicroK8s and K3s</strong> but you won't find it in <a href="https://docs.kubemq.io/installation/docker.html" rel="nofollow noreferrer">Docker</a> section. Basically if you didn't create your <code>kubemq</code> instance using <code>kubemqctl cluster create</code> command, you also won't be able to list it using <code>kubemqctl cluster get</code> as this is not a <code>cluster</code>.</p>
<p>However you can still successfully run other <code>kubemqctl</code> commands and their sub-commands against your standalone <code>kubemq</code> instance running on a single <code>docker</code> container. You can actually run most of commands listed below (excluding <code>cluster</code>):</p>
<pre><code>$ kubemqctl 
Usage:
  kubemqctl [command]

Available Commands:
  cluster      Executes KubeMQ cluster management commands
  commands     Execute KubeMQ 'commands' RPC commands
  config       Run Kubemqctl configuration wizard command
  events       Execute KubeMQ 'events' Pub/Sub commands
  events_store Execute KubeMQ 'events_store' Pub/Sub commands
  help         Help about any command
  queries      Execute KubeMQ 'queries' RPC based commands
  queues       Execute KubeMQ 'queues' commands

Flags:
  -h, --help      help for kubemqctl
      --version   version for kubemqctl

Use &quot;kubemqctl [command] --help&quot; for more information about a command.
</code></pre>
<p>As I already mentioned your <code>.kubemqctl.yaml</code> looks totally fine. It is properly configured to run commands against your <code>kubemq</code> running in <code>docker</code>. When I run <code>docker ps</code> on my machine I can see properly deployed <code>kubemq</code> container:</p>
<pre><code>c9adac88484f        kubemq/kubemq          &quot;./kubemq-run&quot;           3 hours ago         Up 3 hours          0.0.0.0:8080-&gt;8080/tcp, 0.0.0.0:9090-&gt;9090/tcp, 0.0.0.0:50000-&gt;50000/tcp   sleepy_ganguly
</code></pre>
<p>As you can see in the output above (or in the output added to your question as it is almost the same), it properly maps required ports exposed by <code>container</code> to machine's localhost address. You can also check it with <code>netstat</code> command:</p>
<pre><code>$ sudo netstat -ntlp | egrep &quot;8080|9090|50000&quot;
tcp6       0      0 :::8080                 :::*                    LISTEN      21431/docker-proxy
tcp6       0      0 :::50000                :::*                    LISTEN      21394/docker-proxy
tcp6       0      0 :::9090                 :::*                    LISTEN      21419/docker-proxy
</code></pre>
<p>It's basically enough to be able to use such <code>kubemq</code> instance. Let's run a few example commands.</p>
<p>Running simple:</p>
<pre><code>kubemqctl queues
</code></pre>
<p>will show us its <code>help</code> page which specifies how it should be used and gives some useful examples. Let's pick <code>kubemqctl queues list</code> as first:</p>
<pre><code>$ kubemqctl queues list
CHANNELS:
NAME  CLIENTS  MESSAGES  BYTES  FIRST_SEQUENCE  LAST_SEQUENCE
q1    1        12        2621   1               12

TOTAL CHANNELS:  1

CLIENTS:
CLIENT_ID                             CHANNEL  ACTIVE  LAST_SENT  PENDING  STALLED
#####################################  q1       false   2          1        true

TOTAL CLIENTS:  1
</code></pre>
<p>Let's pick another one:</p>
<pre><code>kubemqctl queues send
</code></pre>
<p>Again, when run without required flags and parameters, it shows us some helpful usage examples:</p>
<pre><code>Error: Missing Arguments, Must Be 2 Arguments, Channel And A Message
Try: 
    # Send message to a queue channel channel
    kubemqctl queue send q1 some-message
    
    # Send message to a queue channel with metadata
    kubemqctl queue send q1 some-message --metadata some-metadata
    
    # Send 5 messages to a queues channel with metadata
    kubemqctl queue send q1 some-message --metadata some-metadata -m 5
    
    # Send message to a queue channel with a message expiration of 5 seconds
    kubemqctl queue send q1 some-message -e 5

    # Send message to a queue channel with a message delay of 5 seconds
    kubemqctl queue send q1 some-message -d 5

    # Send message to a queue channel with a message policy of max receive 5 times and dead-letter queue 'dead-letter'
    kubemqctl queue send q1 some-message -r 5 -q dead-letter
</code></pre>
<p>Let's run one of them (slightly modified):</p>
<pre><code>kubemqctl queue send queue2 some-message --metadata some-metadata
</code></pre>
<p>You should see similar output:</p>
<pre><code>[Channel: queue2] [client id: ##############################] -&gt; {id: ############################, metadata: some-metadata, body: some-message - (0), sent at: #### }
</code></pre>
<p>Now if you list our available queues with <code>kubemqctl queues list</code> command, you'll see among others (q1 was previously created by me) our recently created queue named <code>queue2</code>:</p>
<pre><code>CHANNELS:
NAME    CLIENTS  MESSAGES  BYTES  FIRST_SEQUENCE  LAST_SEQUENCE
q1      1        12        2621   1               12
queue2  0        1         232    1               1

TOTAL CHANNELS:  2
...
</code></pre>
<p>It was just an example to show you that it can be run against <strong><code>kubemq</code> instance running on a single docker container</strong> but you can run the same way other <code>kubemqctl</code> commands such as <code>commands</code>, <code>events</code> or <code>queries</code>. <code>kubemqctl</code> has really good <code>context help</code> with many usage examples so you should find easily what you need.</p>
<p>I hope I was able to clear up all the ambiguities.</p>
