开发者社区 > 云原生 > 微服务 > 正文

Higress这个问题怎么解决?

Higress这个问题怎么解决?创建ingress资源,域名->nginx容器->aurora服务,无法通过域名访问到aurora服务(仅修改ingressClassName为nginx ingress controller就可以访问)gateway日志(没有upstream的任何信息):lQLPKdLI6EBeWRvMms0J3rAu5TmULzg-JQZ5nf79E74A_2526_154.png
controller.higress-core日志:lQLPKIWmf6BsyRvMn80Ex7CMDQoAY_L-8wZ5nf79E74C_1223_159.png
controller.discovery日志(其它名称空间服务也会有这个日志):lQLPJx_aYKxzWRvMls0JHLCFqcn7TrhmXgZ5nf79E74B_2332_150.png
ingress资源:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: aurora-web-higress-ing
namespace: aurora-prod
spec:
ingressClassName: ywjkz-higress
ingressClassName: ops-nginx
rules:

- host: aurora-web.xxxxx.com
  http:
    paths:
      - backend:
          service: 
            name: aurora-web-svc
            port: 
              number: 8080
        path: /
        pathType: Prefix

nginx 容器配置

cat /etc/nginx/conf.d/aurora-web.conf

server {
listen 8080;
server_name aurora-web.xxxxx.com;
location / {
root /usr/share/nginx/html;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
try_files $uri $uri/ /index.html;
}

location /goto {
    proxy_set_header Host $http_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;
    proxy_pass http://aurora-svc:8888;
}

location /api {
    proxy_set_header Host $http_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;
    rewrite ^/api/(.*)$ /$1 break;
    proxy_pass http://aurora-svc:8888;
 }

}

展开
收起
三分钟热度的鱼 2024-07-17 22:59:11 22 0
1 条回答
写回答
取消 提交回答

为微服务建设降本增效,为微服务落地保驾护航。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载