我在 Rancher Kubernetes Engine 上有 mysql 服务,需要通过 Nodeport 访问以进行远程访问。我已经尝试过使用其他服务,如 elasticsearch 和 grafana 仪表板,并且可以通过 nodeport 访问,为什么 mysql 不能
这是我的服务
kind: Service
metadata:
labels:
app: mysql
service: mysql
name: proxy-mysql-service
namespace: x4-s24
spec:
type: NodePort
selector:
app: mysql
ports:
- name: tcp-transfer
port: 3306
targetPort: 3306
nodePort: 30036
有状态集
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
namespace: x4-s24
labels:
app: mysql
spec:
replicas: 1
updateStrategy:
type: OnDelete
serviceName: proxy-mysql-service
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
priorityClassName: high-priority
containers:
- image: mysql:8.0.26
imagePullPolicy: Always
name: mysql
resources:
requests:
memory: 512Mi
cpu: 200m
ports:
- containerPort: 3306
name: tcp-mysql
protocol: TCP
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-password-root
volumeMounts:
- name: mysql
mountPath: /var/lib/mysql
- name: mysql-config
mountPath: /etc/mysql/my.cnf
subPath: my.cnf
volumes:
- name: mysql
persistentVolumeClaim:
claimName: mysql-8-pv
- name: mysql-config
configMap:
name: mysql-configmap2
已经在 my.cnf 上添加了 bind-address = 0.0.0.0 但仍然无法正常工作