Microk8s 上的 Istio 不路由

问题描述

我正在尝试通过 istio 网关和 istio 虚拟服务公开 istio 的监控服务:grafana、prometheus、kiali 和 jaeguer,但没有成功

奇怪的是通过curl访问时返回页面,但是通过浏览器访问时网关没有找到应用程序

我试了好几种方法,放到认的nasmespace,放到istio的命名空间,重新创建服务器

非常欢迎任何帮助

  • 环境
SO: Ubuntu 20.04.2 LTS
Kubernetes: Microk8s 1.21/stable 

Client Version: version.Info{Major:"1",Minor:"21+",GitVersion:"v1.21.1-3+1f02fea99e2268",GitCommit:"1f02fea99e226878ded82f3e159f28a6706ce1fc",GitTreeState:"clean",BuildDate:"2021-05-12T21:06:02Z",GoVersion:"go1.16.3",Compiler:"gc",Platform:"linux/amd64"}
Server Version: version.Info{Major:"1",BuildDate:"2021-05-12T21:02:46Z",Platform:"linux/amd64"}

Istio: v1.5.1

Error

  • yaml 配置
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
Metadata:
  name: istio-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
      - "grafana.myserver.com"
      - "prometheus.myserver.com"
      - "kiali.myserver.com"
      - "jaeger.myserver.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: grafana-vs
  namespace: istio-system
spec:
  hosts:
  - "grafana.myserver.com"
  gateways:
  - istio-gateway
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 3000
        host: grafana.istio-system.svc.cluster.local
      weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: prometheus-vs
  namespace: istio-system
spec:
  hosts:
  - "prometheus.myserver.com"
  gateways:
  - istio-gateway
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 9090
        host: prometheus.istio-system.svc.cluster.local
      weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: kiali-vs
  namespace: istio-system
spec:
  hosts:
  - "kiali.myserver.com"
  gateways:
  - istio-gateway
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 20001
        host: kiali.istio-system.svc.cluster.local
      weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: jaeger-vs
  namespace: istio-system
spec:
  hosts:
  - "jaeger.myserver.com"
  gateways:
  - istio-gateway
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 16686
        host: jaeger-query.istio-system.svc.cluster.local
      weight: 100
  • Istio 信息
apiVersion: v1
kind: Service
Metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","Metadata":{"annotations":{},"labels":{"app":"istio-ingressgateway","chart":"gateways","heritage":"Tiller","istio":"ingressgateway","release":"istio"},"name":"istio-ingressgateway","namespace":"istio-system"},"spec":{"ports":[{"name":"status-port","port":15020,"targetPort":15020},{"name":"http2","nodePort":31380,"port":80,"targetPort":80},{"name":"https","nodePort":31390,"port":443},{"name":"tcp","nodePort":31400,"port":31400},{"name":"https-kiali","port":15029,"targetPort":15029},{"name":"https-prometheus","port":15030,"targetPort":15030},{"name":"https-grafana","port":15031,"targetPort":15031},{"name":"https-tracing","port":15032,"targetPort":15032},{"name":"tls","port":15443,"targetPort":15443}],"selector":{"app":"istio-ingressgateway","type":"LoadBalancer"}}
  creationTimestamp: "2021-05-21T10:45:05Z"
  labels:
    app: istio-ingressgateway
    chart: gateways
    heritage: Tiller
    istio: ingressgateway
    release: istio
  name: istio-ingressgateway
  namespace: istio-system
  resourceVersion: "79445"
  selfLink: /api/v1/namespaces/istio-system/services/istio-ingressgateway
  uid: b2a9d401-8ecc-4c3a-bac2-a8db545b80e7
spec:
  clusterIP: 10.152.183.203
  clusterIPs:
  - 10.152.183.203
  externalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: status-port
    nodePort: 30037
    port: 15020
    protocol: TCP
    targetPort: 15020
  - name: http2
    nodePort: 31380
    port: 80
    protocol: TCP
    targetPort: 80
  - name: https
    nodePort: 31390
    port: 443
    protocol: TCP
    targetPort: 443
  - name: tcp
    nodePort: 31400
    port: 31400
    protocol: TCP
    targetPort: 31400
  - name: https-kiali
    nodePort: 31537
    port: 15029
    protocol: TCP
    targetPort: 15029
  - name: https-prometheus
    nodePort: 32117
    port: 15030
    protocol: TCP
    targetPort: 15030
  - name: https-grafana
    nodePort: 31687
    port: 15031
    protocol: TCP
    targetPort: 15031
  - name: https-tracing
    nodePort: 32132
    port: 15032
    protocol: TCP
    targetPort: 15032
  - name: tls
    nodePort: 32291
    port: 15443
    protocol: TCP
    targetPort: 15443
  selector:
    app: istio-ingressgateway
    istio: ingressgateway
    release: istio
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)