如何为合流模式注册表指定nodeport?

wgmfuz8q  于 2021-06-05  发布在  Kafka
关注(0)|答案(1)|浏览(245)

参照以下舵图:https://github.com/confluentinc/cp-helm-charts
我正在尝试使模式注册表对k8s集群中的pod可用。为此,我在values.yaml和service.yaml中添加了一个nodeport:
值.yaml:


## External access.

## 

external:
  enabled: true
  # type can be either NodePort or LoadBalancer
  type: NodePort
  nodePort: 31095

服务.yaml:

spec:
  ports:
    - name: schema-registry
      port: {{ .Values.servicePort }}
      nodePort: {{ .Values.external.node_port }}

部署图表时,节点端口不会出现:

kubectl get svc cp-schema-registry -n kafka-namespace
NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
cp-schema-registry   ClusterIP   10.4.26.199   <none>        8081/TCP   34m
zbdgwd5y

zbdgwd5y1#

这是由service.yaml文件中的一个输入错误引起的。在值文件中,我们有:

external:
  enabled: true
  # type can be either NodePort or LoadBalancer
  type: NodePort
  nodePort: 31095

service.yaml是指节点端口的值:节点端口,它在values.yaml中不存在。将此更改为:

nodePort: {{ .Values.external.nodePort }}

解决了这个问题。

相关问题