如何为 Confluent Schema Registry 指定 nodePort?

How do I specify a nodePort for Confluent Schema Registry?

参考以下掌舵图: https://github.com/confluentinc/cp-helm-charts

我正在尝试使模式注册表对 k8s 集群中的 pods 可用。为此,我向 values.yaml 和 service.yaml:

添加了一个节点端口

values.yaml:

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

service.yaml:

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

当我部署图表时,nodePort 没有出现:

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

这是由于 service.yaml 文件中的拼写错误造成的。在值文件中,我们有:

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

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

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

已解决问题。