我有一个 Web 应用程序的负载均衡器服务。
页面应该以 http:///productpage 启动 如果我们打开 http://LB ,它将只显示空白页面,因为主要产品在 productpage url 中。
那么,如何在 istio gateway VirtualService 中配置这个呢? 请提出建议。
我试过的样品。
部署:
apiVersion: v1
kind: Service
metadata:
name: mart-service
labels:
app: mart
service: mart
spec:
selector:
app: mart
ports:
- name: http
port: 80
targetPort: 18170
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mart-details
labels:
account: mart
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mart-deployment
labels:
app: mart
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: mart
version: v1
template:
metadata:
labels:
app: mart
version: v1
spec:
serviceAccountName: mart-details
containers:
- name: mart
image: martserver.azurecr.io/mart:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 18170
name: mart-port
#securityContext:
#runAsUser: 1000
volumeMounts:
- mountPath: /home/spring/AppData/Local/erwin/Mart Server/
name: mart-volume
volumes:
- name: mart-volume
persistentVolumeClaim:
claimName: martpv
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: martpv
labels:
app: mart
version: v1
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile
resources:
requests:
storage: 5Gi
网关:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: martserver-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
虚拟服务:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: martserver
spec:
hosts:
- "*"
gateways:
- martserver-gateway
http:
- match:
- uri:
exact: /MartServer
- uri:
exact: /
route:
- destination:
host: mart-service
port:
number: 80
请忽略该图片,因为它是私人仓库。 当我尝试使用 LoadBalancer 类型的服务和连接时,该产品工作正常。
页面打不开:http://IG/MartServer
还有,kiali 输出。