【发布时间】:2021-04-01 19:43:09
【问题描述】:
我的图表中有这个服务文件,如何允许 kuberiq 外部的 JDBC 连接,例如 DBeaver?我试图配置nodeport,但它一直失败。有人可以帮忙吗?
apiVersion: v1
kind: Service
metadata:
name: {{ include "ignite.fullname" . }}
labels:
app: {{ include "ignite.fullname" . }}
spec:
ports:
- name: jdbc
port: 11211
targetPort: 11211
- name: spi-communication
port: 47100
targetPort: 47100
- name: spi-discovery
port: 47500
targetPort: 47500
- name: jmx
port: 49112
targetPort: 49112
- name: sql
port: 10800
targetPort: 10800
- name: rest
port: 8080
targetPort: 8080
- name: thin-clients
port: 10900
targetPort: 10900
clusterIP: None
selector:
这是我想尝试连接的 ignite 服务,即使只是为了创建用户
$ kubectl describe svc ignite
Name: ignite
Namespace: production
Labels: app=ignite
Annotations: <none>
Selector: app=ignite
Type: ClusterIP
IP: None
Port: jdbc 11211/TCP
TargetPort: 11211/TCP
Endpoints: 10.233.112.245:11211,10.233.112.246:11211
Port: spi-communication 47100/TCP
TargetPort: 47100/TCP
Endpoints: 10.233.112.245:47100,10.233.112.246:47100
Port: spi-discovery 47500/TCP
TargetPort: 47500/TCP
Endpoints: 10.233.112.245:47500,10.233.112.246:47500
Port: jmx 49112/TCP
TargetPort: 49112/TCP
Endpoints: 10.233.112.245:49112,10.233.112.246:49112
Port: sql 10800/TCP
TargetPort: 10800/TCP
Endpoints: 10.233.112.245:10800,10.233.112.246:10800
Port: rest 8080/TCP
TargetPort: 8080/TCP
Endpoints: 10.233.112.245:8080,10.233.112.246:8080
Port: thin-clients 10900/TCP
TargetPort: 10900/TCP
Endpoints: 10.233.112.245:10900,10.233.112.246:10900
Session Affinity: None
Events: <none>
我尝试像下面这样添加节点端口,但它没有保存它。怎么了?
apiVersion: v1
kind: Service
metadata:
name: {{ include "ignite.fullname" . }}
labels:
app: {{ include "ignite.fullname" . }}
spec:
ClusterIP:
ports:
- name: jdbc
port: 11211
targetPort: 11211
- name: spi-communication
port: 47100
targetPort: 47100
- name: spi-discovery
port: 47500
targetPort: 47500
- name: jmx
port: 49112
targetPort: 49112
- name: sql
port: 10800
targetPort: 10800
nodedport: 30008
- name: rest
port: 8080
targetPort: 8080
- name: thin-clients
port: 10900
targetPort: 10900
selector:
app: {{ include "ignite.fullname" . }}
sessionAffinity: None
type: NodePort
【问题讨论】:
-
在这个例子中 (kubernetes.io/docs/tutorials/stateless-application/…) 它被定义为
containerPort而你没有它。另外请尝试运行命令kubectl describe ...以显示详细问题,否则很难帮助您:)。 -
感谢回复 :) 添加了用于 ignite 的描述 svc
-
您似乎在使用headless-services。尝试实际配置nodeport service。如果您有任何问题,请告诉我
-
您还需要删除
clusterIP: None,因为它不能为 NodePort 的 None。如果您遇到任何错误并且不知道如何解决它们,请将它们粘贴在这里。我帮你会容易得多。 -
Invalid value: "": field is immutable- 这意味着您不能只更新服务。您需要重新创建它。尝试使用--force标志运行 helm
标签: kubernetes jdbc ignite