emqxdashboard用k8s的ingress暴露域名访问该怎么配置

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: emqx-dash-ingress
namespace: lianhe
spec:
ingressClassName: nginx
rules:

  • host: emqxdash.prod.uxxxx.cn
    http:
    paths:
    • backend:
      service:
      name: emqx-dashboard
      port:
      number: 18083
      path: /
      pathType: Prefix
      目前以域名形式访问有问题,svc IP:端口的形式去访问是没问题的,请教正确配置方法

具体应该是 只开放80在负载上 代理到ingress的dashboard 80 就不能打开

只有在ingress做了TLS配置后才可以正常访问

2024-05-21T09:18:51.265724+00:00 [warning] msg: unexpected_api_access, mfa: emqx_dashboard_not_found:init/2, line: 25, request: #{bindings => #{},body_length => 0,cert => undefined,has_body => false,headers => #{<<“accept”>> => <<“text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8”>>,<<“accept-encoding”>> => <<“gzip, deflate, br”>>,<<“accept-language”>> => <<“en-US,en;q=0.5”>>,<<“cache-control”>> => <<“max-age=0”>>,<<“host”>> => <<“emqxdash.prod.xxxxxxxx.cn”>>,<<“sec-fetch-dest”>> => <<“document”>>,<<“sec-fetch-mode”>> => <<“navigate”>>,<<“sec-fetch-site”>> => <<“none”>>,<<“sec-fetch-user”>> => <<“?1”>>,<<“upgrade-insecure-requests”>> => <<“1”>>,<<“user-agent”>> => <<“Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1”>>,<<“x-forwarded-for”>> => <<“172.16.0.235”>>,<<“x-forwarded-host”>> => <<“emqxdash.prod.xxxxxxxx.cn”>>,<<“x-forwarded-port”>> => <<“443”>>,<<“x-forwarded-proto”>> => <<“https”>>,<<“x-forwarded-scheme”>> => <<“https”>>,<<“x-real-ip”>> => <<“172.16.0.235”>>,<<“x-request-id”>> => <<“2bbb49e78c79fbb5032996655582e09d”>>,<<“x-scheme”>> => <<“https”>>},host => <<“emqxdash.prod.xxxxxxxx.cn”>>,host_info => undefined,method => <<“GET”>>,path => <<“/favicon.ico”>>,path_info => undefined,peer => {{10,244,6,45},35620},pid => <0.14596.1425>,port => 80,qs => <<>>,ref => ‘http:dashboard’,scheme => <<“http”>>,sock => {{10,244,4,114},18083},streamid => 1,version => ‘HTTP/1.1’}
2024-05-21T16:52:15.220041+00:00 [warning] msg: unexpected_api_access, mfa: emqx_dashboard_not_found:init/2, line: 25, request: #{bindings => #{},body_length => 0,cert => undefined,has_body => false,headers => #{<<“accept”>> => <<“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8”>>,<<“accept-encoding”>> => <<“gzip, deflate”>>,<<“accept-language”>> => <<“tl-PH,tl;q=0.9,en-US;q=0.8,en;q=0.7”>>,<<“host”>> => <<“emqxdash.prod.xxxxxxxx.cn”>>,<<“upgrade-insecure-requests”>> => <<“1”>>,<<“user-agent”>> => <<“Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1”>>,<<“x-forwarded-for”>> => <<“172.16.0.235”>>,<<“x-forwarded-host”>> => <<“emqxdash.prod.xxxxxxxx.cn”>>,<<“x-forwarded-port”>> => <<“80”>>,<<“x-forwarded-proto”>> => <<“http”>>,<<“x-forwarded-scheme”>> => <<“http”>>,<<“x-real-ip”>> => <<“172.16.0.235”>>,<<“x-request-id”>> => <<“9b629b5d7ae3d7b3271674587214f46e”>>,<<“x-scheme”>> => <<“http”>>},host => <<“emqxdash.prod.xxxxxxxx.cn”>>,host_info => undefined,method => <<“GET”>>,path => <<“/favicon.ico”>>,path_info => undefined,peer => {{10,244,5,196},35764},pid => <0.5898.1437>,port => 80,qs => <<>>,ref => ‘http:dashboard’,scheme => <<“http”>>,sock => {{10,244,4,114},18083},streamid => 1,version => ‘HTTP/1.1’}

你好,能贴下现在报这个错误时 k8s 的配置么

emqx的配置 还是 k8s的ingress?ingress已经贴了

apiVersion: apps.emqx.io/v2beta1
kind: EMQX
metadata:
name: emqx
namespace: xxxxxx
spec:
image: emqx:5.1
config:
data: |
listeners.tcp.prod {
bind = “0.0.0.0:1884”
max_conn_rate = “10000/s”
messages_rate = “10000/s”
bytes_rate = “1000KB/s”
max_connections = 40000
acceptors = “64”
}
coreTemplate:
spec:
volumeClaimTemplates:
storageClassName: emqx-pvc
resources:
requests:
storage: 10Gi
accessModes:
- ReadWriteOnce
replicas: 3
resources:
requests:
memory: 1000Mi
limits:
memory: 1000Mi
podSecurityContext:
sysctls:
- name: net.core.somaxconn
value: “32768”
- name: net.ipv4.ip_local_port_range
value: “33000 65535”
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: emcore
operator: In
values:
- “yes”
replicantTemplate:
spec:
replicas: 1
resources:
requests:
memory: 1024Mi
limits:
memory: 1024Mi
podSecurityContext:
sysctls:
- name: net.core.somaxconn
value: “32768”
- name: net.ipv4.ip_local_port_range
value: “33000 65535”
nodeSelector:
emqx: slave
listenersServiceTemplate:
spec:
type: NodePort
dashboardServiceTemplate:
spec:
type: NodePort

走NodePort 公网IP:NodePort 就没事 走ingress就报错



这是我这边测试的结果

请问你的 host 地址可以正常的解析么? 用 nslookup 命令检查一下

[root@client ~]# curl http://emqxdash.prod.xxxx.cn
curl: (52) Empty reply from server
[root@client ~]# nslookup http://emqxdash.prod.xxxx.cn
Server: 11.0.1.2
Address: 11.0.1.2#53

Non-authoritative answer:
Name: http://emqxdash.prod.xxxx.cn
Address: 47.93.xxx.xxx

这个跟网络带宽有关系嘛

遇到同样的问题,现在解决了么。