【发布时间】:2020-04-29 12:34:08
【问题描述】:
我正在尝试按照https://istio.io/blog/2019/custom-ingress-gateway 处的说明使用 Istio 网关和 VirtualService 公开服务
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demo
name: demo
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- image: nginx
name: nginx
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: demo
name: demo
namespace: demo
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: demo
type: ClusterIP
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: demo-gw
namespace: demo
spec:
selector:
app: demo
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "example.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: demo-vs
namespace: demo
spec:
hosts:
- "example.com"
gateways:
- demo-gw
http:
- route:
- destination:
host: demo
我正在使用minikube tunnel 运行minikube 集群,因此istio-ingressgateway 具有LoadBalancer IP。我已将/etc/hosts 修改为将example.com 指向istio-ingressgateway 服务IP,就像这样
10.111.251.46 example.com
请求似乎确实到达了 Envoy 代理。 curl -v -X TRACE http://example.com返回
* Trying 10.111.251.46...
* TCP_NODELAY set
* Connected to example.com (10.111.251.46) port 80 (#0)
> TRACE / HTTP/1.1
> Host: example.com
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< date: Wed, 29 Apr 2020 12:32:49 GMT
< server: istio-envoy
< content-length: 0
<
* Connection #0 to host example.com left intact
* Closing connection 0
【问题讨论】:
-
您好,您链接的博文已过时。
This blog post was written assuming Istio 1, so some of this content may now be outdated.你的 minikube 集群上的 Istio 版本是什么? -
我在 Kubernetes 1.18、minikube 1.9.1 上运行 Istio 1.5
标签: kubernetes istio envoyproxy