Я пытаюсь предоставить Сервис с помощью Istio Gateway и VirtualService, следуя инструкциям на https://istio.io/blog/2019/custom-ingress-gateway
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
с minikube tunnel
так что 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