I deployed a MySQL pod with the example from the kubernetes website: https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/
I can access the pod from the pod network but not from outside the cluster, how can I achieve this? I would want to access the service via MySQL Workbench for easier editing of the Database.
I already tried to setup a NodePort service like this:
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
targetPort: 3006
nodePort: 30003
selector:
app: mysql
type: NodePort
with the goal to access the service at <master-ip>:30003 but that does not work.
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
targetPort: 3006
nodePort: 30003
selector:
app: mysql
type: NodePort
the targetPort is 3006 instead of 3306, it was a typo.