gpt4 book ai didi

kubernetes - namespace 中的Istio自定义网关

转载 作者:行者123 更新时间:2023-12-02 12:28:08 26 4
gpt4 key购买 nike

我正在尝试按照https://istio.io/blog/2019/custom-ingress-gateway上的说明使用Istio Gateway和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运行 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

最佳答案

正如@Piotr Malec在评论中提到的

The blog post You linked is outdated. This blog post was written assuming Istio 1, so some of this content may now be outdated.



我建议使用 istio operator,因为istio 1.5是添加自定义入口网关的最佳选择。

有一个开放的 github issue,有几种安装方法。

例如,使用此 comment中的yaml,您可以使用默认的入口网关安装istio默认配置文件,此外,它将在 namespace dev中创建第二个入口网关。

希望您觉得这个有帮助。

关于kubernetes - namespace 中的Istio自定义网关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61501934/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com