【发布时间】:2021-08-13 05:46:31
【问题描述】:
问题
我正在尝试学习 Istio,并且正在设置我的 Istio Ingress-Gateway。当我设置它时,有以下端口选项(as indicated here):
- 端口
- 节点端口
- 目标端口
NodePort 对我来说很有意义。这是 Ingress-Gateway 将在 Kubernetes 集群中的每个工作节点上侦听的端口。到达那里的请求将使用 Ingress Gateway CRD 路由到 Kubernetes 集群。
在示例中,Port 通常设置为其匹配流量的公共端口(80 用于 http,443 用于 https 等)。我不明白 Istio 需要这个端口做什么,因为除了 NodePort 之外我没有看到任何流量。
TargetPort 对我来说是个谜。我看过一些关于普通 Istio 网关的文档(说它是only applicable when using ServiceEntries),但对于 Ingress-Gateway 没有任何意义。
我的问题是,关于 Ingress-Gateway(不是普通网关),TargetPort 是什么?
更多详情
最后,我正在尝试调试为什么我的入口流量会收到“连接被拒绝”响应。
我使用以下配置设置了我的 Istio Operator following this tutorial:
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
name: istio-controlplane
namespace: istio-system
spec:
components:
ingressGateways:
- enabled: true
k8s:
service:
ports:
- name: http2
port: 80
nodePort: 30980
hpaSpec:
minReplicas: 2
name: istio-ingressgateway
pilot:
enabled: true
k8s:
hpaSpec:
minReplicas: 2
profile: default
我从配置中省略了 TargetPort,因为我发现 this release notes 表示 Istio 将选择安全的默认值。
我尝试按照this tutorial 中的步骤进行操作。
我尝试了该教程中指示的 curl 命令:
curl -s -I -H Host:httpbin.example.com "http://10.20.30.40:30980/status/200"
收到Failed to connect to 10.20.30.40 port 30980: Connection refused的回复
但是我可以 ping 10.20.30.40 很好,并且获取 NodePort 的命令返回 30980。
所以我开始想,这可能是我不理解的 TargetPort 设置的问题。
检查istiod 日志暗示我可能走在正确的轨道上。我跑了:
kubectl logs -n istio-system -l app=istiod
在我找到的日志中:
warn buildGatewayListeners: skipping privileged gateway port 80 for node istio-ingressgateway-dc748bc9-q44j7.istio-system as it is an unprivileged pod
warn gateway has zero listeners for node istio-ingressgateway-dc748bc9-q44j7.istio-system
所以,如果你能走到这一步,那就哇!我感谢你阅读这一切。如果您对我需要将 TargetPort 设置为什么有任何建议,或者如果我缺少其他内容,我很想听听。
【问题讨论】:
标签: kubernetes istio istio-gateway