minikube-mongodb-demo
minikube-mongodb-demo copied to clipboard
How to access from outside minikube?
How would you configure this to access from outside minikube? Otherwise, the tutorial seems to have worked - it looks like things are up and running. But I'd like to be able to hook up Robo3T from my workstation to poke at the mongo database.
Ya without this information this is completely useless repo IMO. Here is what I had to do to get it to connect externally:
Change the service config within mongodb-service.yaml to:
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
labels:
name: mongo
spec:
ports:
- port: 27017
targetPort: 27017
nodePort: 30000
type: NodePort
selector:
role: mongo
Run the cluster as instructed in README.md
Then at the prompt:
$./configure_repset_auth.sh abc123
$minikube service mongodb-service --url http://192.168.99.101:30000
Use the above IP and port to connect to mongo with user as main_admin and password as abc123
Ya without this information this is completely useless repo IMO. Here is what I had to do to get it to connect externally:
Change the service config within mongodb-service.yaml to:
apiVersion: v1 kind: Service metadata: name: mongodb-service labels: name: mongo spec: ports: - port: 27017 targetPort: 27017 nodePort: 30000 type: NodePort selector: role: mongo
Run the cluster as instructed in README.md
Then at the prompt:
$./configure_repset_auth.sh abc123
$minikube service mongodb-service --url http://192.168.99.101:30000
Use the above IP and port to connect to mongo with user as main_admin and password as abc123
My approach is the same as yours, but do we connect to mongo replicaset using just one host and port? In this case, I think we have to expose totally 3 mongo services. How do you think?
I have proposed a fix using port-forwarding to the service. Your milage may vary but I find it more flexible than the minikube option.