Istio helm 配置 - istio-ingressgateway 端口配置不起作用(或有意义)



我正在使用头盔创建一个具有自定义istio-ingressgateway配置的YML。 请参阅下面的脚本:

#!/usr/bin/env bash
helm template $ISTIO_DIR/install/kubernetes/helm/istio 
--name istio 
--namespace istio-system 
--set gateways.istio-ingressgateway.type=NodePort 
--set gateways.istio-ingressgateway.enabled=true 
--set gateways.istio-ingressgateway.replicaCount=1 
--set gateways.istio-ingressgateway.ports.targetPort=80 
--set gateways.istio-ingressgateway.ports.name=http2 
--set gateways.istio-ingressgateway.ports.nodePort=30000 

--set gateways.istio-ingressgateway.ports.targetPort=443 
--set gateways.istio-ingressgateway.ports.name=https 
--set gateways.istio-ingressgateway.ports.nodePort=30443 

--set gateways.istio-ingressgateway.ports.targetPort=31400 
--set gateways.istio-ingressgateway.ports.name=tcp 
--set gateways.istio-ingressgateway.ports.nodePort=31400 

--set gateways.istio-ingressgateway.ports.targetPort=15011 
--set gateways.istio-ingressgateway.ports.name=tcp-pilot-grpc-tls 
--set gateways.istio-ingressgateway.ports.nodePort=32460 

--set gateways.istio-ingressgateway.ports.targetPort=8060 
--set gateways.istio-ingressgateway.ports.name=tcp-citadel-grpc-tls 
--set gateways.istio-ingressgateway.ports.nodePort=32027 

--set gateways.istio-ingressgateway.ports.targetPort=15030 
--set gateways.istio-ingressgateway.ports.name=http2-prometheus 
--set gateways.istio-ingressgateway.ports.nodePort=31926 

--set gateways.istio-ingressgateway.ports.targetPort=15031 
--set gateways.istio-ingressgateway.ports.name=http2-grafana 
--set gateways.istio-ingressgateway.ports.nodePort=31336 
> eraseme.yaml

但是我收到此错误:

2018/10/22 12:04:54 警告:端口的目标是一个表。忽略非表值 [map[节点端口:31380 端口:80 目标端口:80 名称:http2] 映射[名称:https 节点端口:31390 端口:443] 映射[名称:TCP 节点端口:31400 端口:31400] 映射[端口:15011 目标端口:15011 名称:tcp-pilot-grpc-tls] 映射[名称:tcp-citadel-grpc-TLS 端口:8060 目标端口:8060] 映射[名称:TCP-DNS-TLS 端口:853 目标端口:853] 地图[名称:http2-普罗米修斯端口:15030 目标端口:15030] 地图[名称:http2-grafana 端口:15031 目标端口:15031]] 2018/10/22 12:04:54 警告:端口的目标是一个表。忽略非表值 [map[名称:http2 节点端口:31380 端口:80 目标端口:80] 映射[名称:https 节点端口:31390 端口:443] 映射[名称:TCP 节点端口:31400 端口:31400] 映射[名称:TCP-试点-grpc-TLS 端口:15011 目标端口:15011] 映射[名称:TCP-citadel-grpc-TLS 端口:8060 目标端口:8060] 映射[目标端口:853 名称:TCP-dns-TLS 端口:853] 地图[名称:HTTP2-普罗米修斯端口:15030 目标端口:15030] 地图[名称:http2-grafana 端口:15031 目标端口:15031]] 错误:在"istio/charts/gateways/templates/service.yaml"中呈现错误:template:istio/charts/gateways/templates/service.yaml:32:32:在:range无法迭代http2-grafana时执行"istio/charts/gateways/templates/service.yaml">

我应该如何正确执行此操作?

问题是关于指定数组变量的 Helm 语法。你这样做是这样的:

--set gateways.istio-ingressgateway.ports[0].targetPort=80 
--set gateways.istio-ingressgateway.ports[0].name=http2 
--set gateways.istio-ingressgateway.ports[0].nodePort=30000 

--set gateways.istio-ingressgateway.ports[1].targetPort=443 
--set gateways.istio-ingressgateway.ports[1].name=https 
--set gateways.istio-ingressgateway.ports[1].nodePort=30443 

等,指定数组成员的索引。

我遇到了类似的问题,与其在命令行中添加长参数,不如将其添加到yaml文件中。

helm template $ISTIO_DIR/install/kubernetes/helm/istio 
--name istio 
--namespace istio-system > istio-default.yaml

然后,您可以编辑istio-default.yaml以添加所需的额外端口

# istio-default.yaml (tips: search 31380 to locate this segment)
-
name: http2
nodePort: 31380
port: 80
targetPort: 80
# below is customized port for flask app for example
-
name: http-flask
nodePort: 31500
port: 5000
targetPort: 5000

现在,您可以创建/将配置应用于系统

$ kubectl create -f istio-default.yaml
$ kubectl get svc istio-ingressgateway -n istio-system
NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                                                                     AGE
istio-ingressgateway   LoadBalancer   10.111.192.149   <pending>     80:31380/TCP,5000:31500/TCP,443:31390/TCP,31400:31400/TCP,15029:32630/TCP,15030:31878/TCP,15031:30152/TCP,15032:32060/TCP,15443:31852/TCP,15020:32235/TCP   8m26s

这也是在 istio 安装后添加/删除端口的好方法

有关更多 istio 安装,请参阅选项 1:通过 helm 模板使用 Helm 进行安装

最新更新