Helm Template - Custom ingress port

Dear all,

I’m currently deploying Istio (1.2.4) in our K8s cluster using the helm template to generate the yaml, so we can version at git, and them applying at K8s.

I’m trying to add a custom port (50051) to be the grcp dedicated port, but I’m only accomplishing this by editing the install/kubernetes/helm/istio/charts/gateways/values.yaml and adding the port:

istio-ingressgateway:

ports:

  • port: 50051
    name: grpc
    nodePort: 31401 # The range of valid ports is 30000-32767

With this, I execute the helm template with no issues, but I’m trying to add this custom port at helm template command and get the errors:

❯ helm template install/kubernetes/helm/istio --name istio --set global.mtls.enabled=false --set tracing.enabled=true --set kiali.enabled=true --set grafana.enabled=true --namespace istio-system --set global.proxy.accessLogFile="/dev/stdout" --set gateways.istio-ingressgateway.autoscaleMin=3 --set gateways.istio-ingressgateway.autoscaleMax=8 --set gateways.istio-ingressgateway.ports.targetPort=80 > istio_stdout.yml
2019/08/28 14:45:44 Warning: Merging destination map for chart 'gateways'. The destination item 'ports' is a table and ignoring the source 'ports' as it has a non-table value of: [map[name:status-port port:15020 targetPort:15020] 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:https-kiali port:15029 targetPort:15029] map[name:https-prometheus port:15030 targetPort:15030] map[name:https-grafana port:15031 targetPort:15031] map[name:https-tracing port:15032 targetPort:15032] map[name:tls port:15443 targetPort:15443]]
2019/08/28 14:45:44 Warning: Merging destination map for chart 'gateways'. The destination item 'ports' is a table and ignoring the source 'ports' as it has a non-table value of: [map[name:status-port port:15020 targetPort:15020] 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:https-kiali port:15029 targetPort:15029] map[name:https-prometheus port:15030 targetPort:15030] map[name:https-grafana port:15031 targetPort:15031] map[name:https-tracing port:15032 targetPort:15032] map[name:tls port:15443 targetPort:15443]]
2019/08/28 14:45:44 Warning: Merging destination map for chart 'istio'. The destination item 'ports' is a table and ignoring the source 'ports' as it has a non-table value of: [map[name:status-port port:15020 targetPort:15020] 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:https-kiali port:15029 targetPort:15029] map[name:https-prometheus port:15030 targetPort:15030] map[name:https-grafana port:15031 targetPort:15031] map[name:https-tracing port:15032 targetPort:15032] map[name:tls port:15443 targetPort:15443]]
2019/08/28 14:45:44 Warning: Merging destination map for chart 'gateways'. The destination item 'ports' is a table and ignoring the source 'ports' as it has a non-table value of: [map[name:status-port port:15020 targetPort:15020] 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:https-kiali port:15029 targetPort:15029] map[name:https-prometheus port:15030 targetPort:15030] map[name:https-grafana port:15031 targetPort:15031] map[name:https-tracing port:15032 targetPort:15032] map[name:tls port:15443 targetPort:15443]]
2019/08/28 14:45:44 Warning: Merging destination map for chart 'gateways'. The destination item 'ports' is a table and ignoring the source 'ports' as it has a non-table value of: [map[name:status-port port:15020 targetPort:15020] 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:https-kiali port:15029 targetPort:15029] map[name:https-prometheus port:15030 targetPort:15030] map[name:https-grafana port:15031 targetPort:15031] map[name:https-tracing port:15032 targetPort:15032] map[name:tls port:15443 targetPort:15443]]
Error: render error in "istio/charts/gateways/templates/service.yaml": template: istio/charts/gateways/templates/service.yaml:44:32: executing "istio/charts/gateways/templates/service.yaml" at <$val>: range can't iterate over 80

❯ helm template install/kubernetes/helm/istio --name istio --set global.mtls.enabled=false --set tracing.enabled=true --set kiali.enabled=true --set grafana.enabled=true --namespace istio-system --set global.proxy.accessLogFile="/dev/stdout" --set gateways.istio-ingressgateway.autoscaleMin=3 --set gateways.istio-ingressgateway.autoscaleMax=8 --set gateways.istio-ingressgateway.ports[0].targetPort=50051 > istio_stdout.yml
zsh: no matches found: gateways.istio-ingressgateway.ports[0].targetPort=50051

Can someone help me please?

For the first helm template command you need to specify gateways.istio-ingressgateway.ports[0].targetPort-80

I have no issues generating a yaml with the following command:
helm template install/kubernetes/helm/istio --name istio --set global.mtls.enabled=false --set tracing.enabled=true --set kiali.enabled=true --set grafana.enabled=true --namespace istio-system --set global.proxy.accessLogFile="/dev/stdout" --set gateways.istio-ingressgateway.autoscaleMin=3 --set gateways.istio-ingressgateway.autoscaleMax=8 --set gateways.istio-ingressgateway.ports[0].targetPort=50051 --set gateways.istio-ingressgateway.ports[0].name=grpc --set gateways.istio-ingressgateway.ports[0].nodePort=31401 > istio_stdout.yml

Thanks for helping me, the error was due to the ZSH :cry:
I’ve fixed the command and generated the YAML.

But with this, I’ve overridden all default ports, so to map them need to increment the value and add all ports right?

Yes if those ports are needed in your case.

Thanks, I’ve added all default ports + the custom grpc port with helm template:

helm template install/kubernetes/helm/istio --name istio --set global.mtls.enabled=false \
--set tracing.enabled=true --set kiali.enabled=true --set grafana.enabled=true --namespace istio-system \
--set global.proxy.accessLogFile="/dev/stdout" --set gateways.istio-ingressgateway.autoscaleMin=3 --set gateways.istio-ingressgateway.autoscaleMax=8 \
--set "gateways.istio-ingressgateway.ports[0].targetPort=15020" --set "gateways.istio-ingressgateway.ports[0].name=status-port"  --set "gateways.istio-ingressgateway.ports[0].port=15020" \
--set "gateways.istio-ingressgateway.ports[1].targetPort=80" --set "gateways.istio-ingressgateway.ports[1].name=http2" --set "gateways.istio-ingressgateway.ports[1].nodePort=31380" --set "gateways.istio-ingressgateway.ports[1].port=80" \
--set "gateways.istio-ingressgateway.ports[2].name=https" --set "gateways.istio-ingressgateway.ports[2].nodePort=31390" --set "gateways.istio-ingressgateway.ports[2].port=443" \
--set "gateways.istio-ingressgateway.ports[3].name=tcp" --set "gateways.istio-ingressgateway.ports[3].nodePort=31400" --set "gateways.istio-ingressgateway.ports[3].port=31400" \
--set "gateways.istio-ingressgateway.ports[4].name=https-kiali" --set "gateways.istio-ingressgateway.ports[4].targetPort=15029" --set "gateways.istio-ingressgateway.ports[4].port=15029" \
--set "gateways.istio-ingressgateway.ports[5].name=https-prometheus" --set "gateways.istio-ingressgateway.ports[5].targetPort=15030" --set "gateways.istio-ingressgateway.ports[5].port=15030" \
--set "gateways.istio-ingressgateway.ports[6].name=https-grafana" --set "gateways.istio-ingressgateway.ports[6].targetPort=15031" --set "gateways.istio-ingressgateway.ports[6].port=15031" \
--set "gateways.istio-ingressgateway.ports[7].name=https-tracing" --set "gateways.istio-ingressgateway.ports[7].targetPort=15032" --set "gateways.istio-ingressgateway.ports[7].port=15032" \
--set "gateways.istio-ingressgateway.ports[8].name=tls" --set "gateways.istio-ingressgateway.ports[8].targetPort=15443" --set "gateways.istio-ingressgateway.ports[8].port=15443" \
--set "gateways.istio-ingressgateway.ports[9].name=grpc" --set "gateways.istio-ingressgateway.ports[9].nodePort=3140" --set "gateways.istio-ingressgateway.ports[9].port=50051" > istio_test.yml 

Again thanks for the help!

Is it necessory to pass the default ports… Can we only pass the custom ports to helm.