Question
我正在尝试学习 Istio,并且正在设置我的 Istio Ingress-Gateway。当我设置它时,有以下端口选项(如此处所示 https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/#ServicePort):
NodePort
我感觉合理。这是 Ingress-Gateway 将在 Kubernetes 集群中的每个工作节点上侦听的端口。到达那里的请求将使用 Ingress Gateway CRD 路由到 Kubernetes 集群。
在示例中,Port
通常设置为其匹配流量的公共端口(http 为 80,https 为 443 等)。我不明白 Istio 需要这个端口做什么,因为我没有看到任何流量使用除 NodePort 之外的任何东西。
TargetPort
对我来说是个谜。我看过一些关于普通 Istio 网关的文档(说它是仅在使用 ServiceEntries 时适用 https://istio.io/latest/docs/reference/config/networking/gateway/#Port),但对于 Ingress-Gateway 来说没有任何意义。
我的问题是,相对于入口网关(不是普通网关),什么是入口网关?TargetPort
?
更多细节
最后,我试图调试为什么我的入口流量收到“连接被拒绝”响应。
我设置了 Istio Operator按照本教程 https://istio.io/latest/docs/setup/install/operator/使用此配置:
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
从我的配置中因为我发现本发行说明 https://istio.io/latest/news/releases/1.7.x/announcing-1.7/upgrade-notes/#gateways-run-as-non-root也就是说,Istio 将选择安全的默认值。
我尝试按照中找到的步骤进行操作本教程 https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-control/.
我尝试了该教程中指示的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 设置为什么有任何建议,或者如果我遗漏了其他内容,我很想听听。