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

时间:2018-10-22 19:12:52

标签: istio kubernetes-helm

我正在使用头盔创建具有自定义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 [nodePort:31380端口:80 targetPort:80名称:http2] map [名称:https nodePort:31390端口:443] map [名称:tcp nodePort:31400端口:31400] map [端口:15011 targetPort:15011名称:tcp-pilot-grpc-tls] map [名称:tcp-城堡-grpc-tls端口:8060 targetPort:8060] map [名称:tcp-dns-tls port:853 targetPort:853] map [名称:http2-prometheus端口:15030 targetPort:15030] map [名称:http2-grafana端口:15031 targetPort:15031]]   2018/10/22 12:04:54警告:端口的目的地是一个表。忽略非表值[map [name:http2 nodePort:31380 port:80 targetPort:80] map [name:https nodePort:31390 port:443] map [name:tcp nodePort:31400 port:31400] map [name:tcp -pilot-grpc-tls端口:15011 targetPort:15011] map [名称:tcp-城堡-grpc-tls端口:8060 targetPort:8060] map [targetPort:853名称:tcp-dns-tls端口:853] map [名称:http2-prometheus端口:15030 targetPort:15030] map [名称:http2-grafana端口:15031 targetPort:15031]]   错误:“ istio / charts / gateways / templates / service.yaml”中的渲染错误:模板:istio / charts / gateways / templates / service.yaml:32:32:执行“ istio / charts / gateways / templates / service.yaml” “:位于:范围无法遍历http2-grafana

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

2 个答案:

答案 0 :(得分:2)

问题是关于用于指定数组变量的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 \

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

答案 1 :(得分:0)

我遇到了类似的问题,与其在命令行中添加长参数,不如将其添加到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的更多安装信息,请参见Option 1: Install with Helm via helm template

相关问题