kos*_*sta 6 gateway google-kubernetes-engine istio kubernetes-ingress
我istio v1.1.1使用可用的舵图进行安装。
我有
$ kubectl get svc istio-ingressgateway -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 10.31.251.20 35.189.53.230 80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:31920/TCP,15030:32305/TCP,15031:31084/TCP,15032:31163/TCP,15443:32714/TCP,15020:30964/TCP 3h
Run Code Online (Sandbox Code Playgroud)
然后,我创建了一个网关和虚拟服务,如下所示:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: myservice-gateway
namespace: stg
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- hosts:
- "stg.myservice.com"
port:
number: 80
protocol: http
name: http-myservice-port
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: myservice
namespace: stg
spec:
hosts:
- "stg.myservice.com"
gateways:
- myservice-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
port:
number: 8888
host: myservice-service.stg.svc.cluster.local
Run Code Online (Sandbox Code Playgroud)
我已确保该服务正确运行,并且当我转发 pod 时,我可以使用 localhost 访问它。
我可以确认stg.myservice.com解析为35.189.53.230. 我收到这个错误
$ curl -i stg.myservice.com
HTTP/1.1 404 Not Found
location: http://stg.myservice.com/
date: Sun, 07 Apr 2019 05:54:59 GMT
server: istio-envoy
content-length: 0
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我在ingress-gatewaypod 中没有看到错误
PS:我有 gateways.istio-ingressgateway.sds.enabled=true
在虚拟服务配置中,您需要向网关添加命名空间
stg/myservice-gateway
Run Code Online (Sandbox Code Playgroud)
代替
myservice-gateway
Run Code Online (Sandbox Code Playgroud)
所以像这样
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: myservice
namespace: stg
spec:
hosts:
- "stg.myservice.com"
gateways:
- stg/myservice-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
port:
number: 8888
host: myservice-service.stg.svc.cluster.local
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5289 次 |
| 最近记录: |