我在 Istio/Kubernetes 上使用 Kiali 来监控我的网格。
我需要基于 URL 包含路由 2 个不同的 pod,为此,我遵循将大型虚拟服务和目标规则拆分为多个资源中的教程。因此,我为同一主机和网关创建了 2 个 VirtualService:
服务一:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: vs-product-composite
spec:
hosts:
- "kubernetes.b-thinking.com"
gateways:
- gw-ingress
http:
- match:
- uri:
prefix: /product-composite
route:
- destination:
port:
number: 80
host: product-composite
服务二:
apiVersion: apps/v1
kind: Deployment
metadata:
name: uaa
spec:
replicas: 1
selector:
matchLabels:
app: uaa
template:
metadata:
labels:
app: uaa
spec:
containers:
- name: uaa
image: bthinking/uaa
imagePullPolicy: Never
env:
- name: LOGGING_LEVEL_ROOT
value: DEBUG
ports:
- containerPort: 8090
resources:
limits:
memory: 350Mi
---
apiVersion: v1
kind: Service
metadata:
name: uaa
spec:
type: NodePort
selector:
app: uaa
ports:
- port: 8090
nodePort: 31090
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: vs-auth
spec:
hosts:
- "kubernetes.b-thinking.com"
gateways:
- gw-ingress
http:
- match:
- uri:
prefix: /oauth
rewrite:
uri: "/uaa/oauth"
route:
- destination:
port:
number: 8090
host: uaa
但是,我收到了警告KIA1106 - More than one Virtual Service for same host
查看docs,它解释了这个案例(这是我的案例),但它重定向到我遵循的同一指南。