我需要在 pod 模板和负载均衡器服务中声明一长串端口(以千计)。我相信必须有一种方法可以做到这一点,而无需在 yaml 中重复以下一千次。有人可以点亮一些灯吗?谢谢。
- name: containerPort10000
containerPort: 10000
更新:恐怕问题现在更复杂了。由于我需要公开 10k 端口(用于连接设备,同时使用 TCP 和 UDP),我需要在 yaml 中指定以下内容:
- targetPort: 10000
port: 10000
nodePort: 10000
name: t10000
protocol: TCP
- targetPort: 10000
port: 10000
nodePort: 10000
name: u10000
protocol: UDP
...
- targetPort: 20000
port: 20000
nodePort: 20000
name: t20000
protocol: TCP
- targetPort: 20000
port: 20000
nodePort: 20000
name: u20000
protocol: UDP
我遇到了The Service "svr" is invalid: metadata.annotations: Too long: must have at most 262144 characters错误。请帮忙。