Istio - 为什么在 LoadBalancer 上打开所有这些端口?
Istio - what for all these ports are opened on LoadBalancer?
我查看由 Istio 创建的 ELB,我看到了所有这些打开的端口:
- 80 (TCP) 转发到 31380 (TCP)
- 443 (TCP) 转发到 31390 (TCP)
- 853 (TCP) 转发到 31107 (TCP)
- 8060 (TCP) 转发到 32130 (TCP)
- 15011 (TCP) 转发到 31942 (TCP)
- 15030 (TCP) 转发到 31438 (TCP)
- 15031 (TCP) 转发到 30695 (TCP)
- 31400 (TCP) 转发到 31400 (TCP)
所有这些端口都暴露在互联网上。除了前两个,所有其他暴露端口的目的是什么?有什么方法(通过 Istio 配置)来控制暴露的内容吗?
您可以在此处查看端口规范:https://github.com/istio/istio/blob/master/install/kubernetes/helm/istio/values-istio-gateways.yaml#L65
ports:
## You can add custom gateway ports
- port: 80
targetPort: 80
name: http2
# nodePort: 31380
- port: 443
name: https
# nodePort: 31390
- port: 31400
name: tcp
# nodePort: 31400
# Pilot and Citadel MTLS ports are enabled in gateway - but will only redirect
# to pilot/citadel if global.meshExpansion settings are enabled.
- port: 15011
targetPort: 15011
name: tcp-pilot-grpc-tls
- port: 8060
targetPort: 8060
name: tcp-citadel-grpc-tls
# Addon ports for kiali are enabled in gateway - but will only redirect if
# the gateway configuration for the various components are enabled.
- port: 15029
- targetPort: 15029
# Telemetry-related ports are enabled in gateway - but will only redirect if
# the gateway configuration for the various components are enabled.
- port: 15030
targetPort: 15030
name: http2-prometheus
- port: 15031
targetPort: 15031
name: http2-grafana
- port: 15032
targetPort: 15032
name: http2-tracing
这些端口在集群外部公开 Istio 的各种组件,例如用于将 VM 或其他集群与 Istio 连接,或者在集群外部公开 Istio 仪表板。
您可以通过 helm 安装选项 https://preliminary.istio.io/docs/reference/config/installation-options/#gateways-options 控制此公开,所有选项名为 gateways.istio-ingressgateway.ports
.
例如,要将公开的端口限制为仅 80 和 443,运行:
helm template install/kubernetes/helm/istio --name istio --namespace istio-system -x charts/gateways/templates/service.yaml --set gateways.istio-ingressgateway.ports[0].port=80 --set gateways.istio-ingressgateway.ports[0].name=http2 --set gateways.istio-ingressgateway.ports[0].targetPort=80 --set gateways.istio-ingressgateway.ports[1].port=443 --set gateways.istio-ingressgateway.ports[1].name=https > $HOME/istio.yaml
检查生成的 $HOME/istio.yaml
并确认只有端口 80 和 443 为 istio-ingressgateway
服务公开。
这可能是一个迟到的回复,但我还是会分享我的发现。
对于 Istio v1.4,您不能使用 --set
命令(参见下面的示例)来限制暴露的端口。
istioctl manifest apply \
--set gateways.istio-ingressgateway.ports[0].port=80 \
--set gateways.istio-ingressgateway.ports[0].name=http2 \
--set gateways.istio-ingressgateway.ports[0].targetPort=80
这些端口由启用 gateway
组件的 Istio 配置文件(例如 default、demo)自动公开。
对我有用的唯一方法是使用 IstioControlPlane API 覆盖 Istio 配置文件的设置。
资料来源:https://istio.io/v1.4/docs/setup/install/istioctl/#customize-istio-settings-using-the-helm-api
这是一个配置,它利用 IstioControlPlane 将 istio-ingressgateway 的暴露端口限制为端口 80 和 443 以及禁用 prometheus。
apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
spec:
values:
gateways:
istio-ingressgateway:
ports:
- name: http2
port: 80
targetPort: 80
- name: https
port: 443
prometheus:
enabled: false
- 将上述清单保存到 yaml 文件中(例如
istio-config.yaml
)
- 部署更改:
istioctl manifest apply -f istio-config.yaml
我查看由 Istio 创建的 ELB,我看到了所有这些打开的端口:
- 80 (TCP) 转发到 31380 (TCP)
- 443 (TCP) 转发到 31390 (TCP)
- 853 (TCP) 转发到 31107 (TCP)
- 8060 (TCP) 转发到 32130 (TCP)
- 15011 (TCP) 转发到 31942 (TCP)
- 15030 (TCP) 转发到 31438 (TCP)
- 15031 (TCP) 转发到 30695 (TCP)
- 31400 (TCP) 转发到 31400 (TCP)
所有这些端口都暴露在互联网上。除了前两个,所有其他暴露端口的目的是什么?有什么方法(通过 Istio 配置)来控制暴露的内容吗?
您可以在此处查看端口规范:https://github.com/istio/istio/blob/master/install/kubernetes/helm/istio/values-istio-gateways.yaml#L65
ports:
## You can add custom gateway ports
- port: 80
targetPort: 80
name: http2
# nodePort: 31380
- port: 443
name: https
# nodePort: 31390
- port: 31400
name: tcp
# nodePort: 31400
# Pilot and Citadel MTLS ports are enabled in gateway - but will only redirect
# to pilot/citadel if global.meshExpansion settings are enabled.
- port: 15011
targetPort: 15011
name: tcp-pilot-grpc-tls
- port: 8060
targetPort: 8060
name: tcp-citadel-grpc-tls
# Addon ports for kiali are enabled in gateway - but will only redirect if
# the gateway configuration for the various components are enabled.
- port: 15029
- targetPort: 15029
# Telemetry-related ports are enabled in gateway - but will only redirect if
# the gateway configuration for the various components are enabled.
- port: 15030
targetPort: 15030
name: http2-prometheus
- port: 15031
targetPort: 15031
name: http2-grafana
- port: 15032
targetPort: 15032
name: http2-tracing
这些端口在集群外部公开 Istio 的各种组件,例如用于将 VM 或其他集群与 Istio 连接,或者在集群外部公开 Istio 仪表板。
您可以通过 helm 安装选项 https://preliminary.istio.io/docs/reference/config/installation-options/#gateways-options 控制此公开,所有选项名为 gateways.istio-ingressgateway.ports
.
例如,要将公开的端口限制为仅 80 和 443,运行:
helm template install/kubernetes/helm/istio --name istio --namespace istio-system -x charts/gateways/templates/service.yaml --set gateways.istio-ingressgateway.ports[0].port=80 --set gateways.istio-ingressgateway.ports[0].name=http2 --set gateways.istio-ingressgateway.ports[0].targetPort=80 --set gateways.istio-ingressgateway.ports[1].port=443 --set gateways.istio-ingressgateway.ports[1].name=https > $HOME/istio.yaml
检查生成的 $HOME/istio.yaml
并确认只有端口 80 和 443 为 istio-ingressgateway
服务公开。
这可能是一个迟到的回复,但我还是会分享我的发现。
对于 Istio v1.4,您不能使用 --set
命令(参见下面的示例)来限制暴露的端口。
istioctl manifest apply \
--set gateways.istio-ingressgateway.ports[0].port=80 \
--set gateways.istio-ingressgateway.ports[0].name=http2 \
--set gateways.istio-ingressgateway.ports[0].targetPort=80
这些端口由启用 gateway
组件的 Istio 配置文件(例如 default、demo)自动公开。
对我有用的唯一方法是使用 IstioControlPlane API 覆盖 Istio 配置文件的设置。 资料来源:https://istio.io/v1.4/docs/setup/install/istioctl/#customize-istio-settings-using-the-helm-api
这是一个配置,它利用 IstioControlPlane 将 istio-ingressgateway 的暴露端口限制为端口 80 和 443 以及禁用 prometheus。
apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
spec:
values:
gateways:
istio-ingressgateway:
ports:
- name: http2
port: 80
targetPort: 80
- name: https
port: 443
prometheus:
enabled: false
- 将上述清单保存到 yaml 文件中(例如
istio-config.yaml
) - 部署更改:
istioctl manifest apply -f istio-config.yaml