参考以下舵图:https://github.com/confluentinc/cp-helm-charts
我正在尝试使模式注册表可用于k8s集群中的Pod。为此,我将一个nodePort添加到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 }}
已解决问题。