【问题标题】:Why helm ignoring node port section?为什么 helm 忽略节点端口部分?
【发布时间】:2019-07-29 20:40:20
【问题描述】:

我正在尝试在特定端口上安装带有 nodeport 的 helm chart。例如:30005,但 helm 忽略 nodeport 部分。

==> v1/Service
NAME       TYPE      CLUSTER-IP     EXTERNAL-IP  PORT(S)         AGE
hello-app  NodePort  10.109.69.245  <none>       8080:32146/TCP  0s

我尝试设置特定端口:

helm install --set service.type=NodePort,service.nodePort=30005 --name hello-app /home/ubuntu/hello-app

我的values.yaml“服务”部分。

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

service:
  type: NodePort
  port: 8080
  nodePort: 30005

我的预期结果:

==> v1/Service
NAME       TYPE      CLUSTER-IP     EXTERNAL-IP  PORT(S)         AGE
hello-app  NodePort  10.109.69.245  <none>       8080:30005/TCP  0s

【问题讨论】:

  • 你能分享你的服务定义吗
  • 对不起,我忘记添加到我的 /template/service.yaml 这个端口:-端口:{{ .Values.service.port }} nodePort:{{ .Values.service.nodePort } } 协议:TCP 目标端口:8080

标签: kubernetes kubernetes-helm


【解决方案1】:

显然,您的服务的 helm 模板中的某个地方有错字,或者忽略了变量名称区分大小写的事实。请仔细检查。

还可以查看官方参考 nginx 图表示例,其中 service helm 模板允许最终用户也可以配置 type 和 nodePort,这与 helm 覆盖参数 (--set )。

您可以在发布安装之前使用以下命令验证 helm 呈现的清单文件:

helm template --set service.type=NodePort --set service.nodePort=31000 --debug docs/examples/nginx/

最后一件事:

请确保,您指定的 nodePort 尚未使用。
您可以使用--server-dry-run 选项和kubectl 来做到这一点,例如

kubectl apply -f service-31000-nodeport-conflict.yaml --server-dry-run

如果它已被占用,您会看到与此类似的错误,从 API 服务器返回:

The Service "release-name-nginx-conflict" is invalid: spec.ports[0].nodePort: Invalid value: 31000: provided port is already allocated

【讨论】:

  • 链接已过时。
猜你喜欢
  • 2019-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多