skip to Main Content

I’m setting up minikube to run services which will communicate via ActiveMQ Artemis.

In order to access the services from other machines, I set up nginx on the host, which forwards from port 19000 to the Ingress Controller port

server {
    listen       19000;
    listen       [::]:19000;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        proxy_pass http://192.168.58.2:32076; # Ingress controller port
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }


    error_page 404 /404.html;
    location = /404.html {
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    }
}

So this works for me, so far. Now I’ve deployed ActiveMQ Artemis.

minikube service list
|---------------|------------------------------------|--------------|---------------------------|
|   NAMESPACE   |                NAME                | TARGET PORT  |            URL            |
|---------------|------------------------------------|--------------|---------------------------|
| default       | artemis-web                        |         8161 | http://192.168.58.2:30001 |

and I can access it with curl -L http://192.168.58.2:30001 via the nodeport.

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>Hawtio</title>
  <base href='/console/'>
  <link id="favicon" rel="icon" type="image/x-icon" href="img/favicon.ico?v=1">

  <link rel="stylesheet" href="css/lib-6a1e4ce9ea.css"/>

  <link rel="stylesheet" href="css/app-9653e9917c.css"/>

  <!-- branding -->
  <link id="branding" rel="stylesheet" type="text/css" href="" />

  <script src="js/lib-e53c220218.js" defer></script>

  <script src="js/app-fafe513f4b.js" defer></script>
</head>


<body>
  <hawtio-login></hawtio-login>
</body>

But I can’t seem to create an nginx server or location mapping to access the web console from my host machine.

For example, adding this:

location /artemis/ {
    proxy_pass http://192.168.58.2:30001;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

and calling http://myip:19000/artemis/
results in

HTTP ERROR 404 Not Found
URI:    /artemis/
STATUS: 404
MESSAGE:    Not Found
SERVLET:    -

Similar results if i make a new server on 19001 that forwards to 30001.

Interestingly, if I try console since I imagine it tries to redirect to :8161/console

location /console/ {
    proxy_pass http://192.168.58.2:30001;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

then curl -L http://myip:19000/console/ says Failed to connect to myip port 80: Connection refused which implies that it’s redirecting to port 80 somehow. (This isn’t configured anywhere).

Anyone managed to access the web console inside minikube?

2

Answers


  1. Chosen as BEST ANSWER

    For those who seek a simple workaround:

    /console redirects to port 80.

    /console/auth/login avoids the port 80 redirection.


  2. I successfully use ArtemisCloud Operator to deploy ActiveMQArtemis on minikube and access the console. The operator create an ingress resource if the spec.console.expose is true, i.e.

    apiVersion: broker.amq.io/v1beta1
    kind: ActiveMQArtemis
    metadata:
      name: my-artemis
    spec:
      console:
        expose: true
        ingressHost: my-artemis.my-domain.io
    
    $ curl -Lv --proxy http://192.168.49.2:80 http://my-artemis.my-domain.io
    

    I created a nigix container based on your config and it worked. I only changed the proxy_pass parameter to <MINIKUBE IP>:80(use the command minikube ip to get <MINIKUBE IP>), i.e.

    $ docker run --name my-nginx --rm -it --network host -p 19000:19000 -v ./nginx.conf:/etc/nginx/nginx.conf:ro nginx
    
    $ curl -Lv --proxy http://localhost:19000 http://my-artemis.my-domain.io
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search