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

问题描述 投票:0回答:2

我正在使用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 port:80 targetPort:80 name:http2] map [name:https nodePort:31390 port:443] map [name:tcp nodePort:31400 port:31400] map [port:15011 targetPort:15011名称:tcp-pilot-grpc-tls] map [name:tcp-citadel-grpc-tls port:8060 targetPort:8060] map [name:tcp-dns-tls port:853 targetPort:853] map [name :http2-prometheus端口:15030 targetPort:15030] map [name:http2-grafana port:15031 targetPort:15031]] 2018/10/22 12:04:54警告:ports的目的地是一个表。忽略非表值[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 port:15011 targetPort:15011] map [name:tcp-citadel-grpc-tls port:8060 targetPort:8060] map [targetPort:853 name:tcp-dns-tls port:853] map [name :http2-prometheus端口:15030 targetPort:15030] map [name:http2-grafana port:15031 targetPort:15031]]错误:“istio / charts / gateways / templates / service.yaml”中的渲染错误:template:istio / charts /gateways/templates/service.yaml:32:32:执行“istio / charts / gateways / templates / service.yaml”at:range不能遍历http2-grafana

我该如何正确地做到这一点?

istio kubernetes-helm
2个回答
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 \

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


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

© www.soinside.com 2019 - 2024. All rights reserved.