Access mysql running on localhost from minikube

As the OS and minikube vm-driver wasn’t mentioned, I assume it is –vm-driver=virtualbox because it’s probably most common case. If you use something different you need to adjust this solution according to your configuration. Explanation: 127.0.0.1 is a localhost(lo0) interface IP address. Nodes, Hosts and Pods have their own localhost interfaces and they are not … Read more

Minikube expose MySQL running on localhost as service

Kubernetes allows you to create a service without selector, and cluster will not create related endpoint for this service, this feature is usually used to proxy a legacy component or an outside component. Create a service without selector apiVersion: v1 kind: Service metadata: name: my-service spec: ports: – protocol: TCP port: 1443 targetPort: <YOUR_MYSQL_PORT> Create … Read more

Connect to local database from inside minikube cluster

I’m using ubuntu with Minikube and my database runs outside of minikube inside a docker container and can be accessed from localhost @ 172.17.0.2. My Kubernetes service for my external mysql container reads as follows: kind: Service apiVersion: v1 metadata: name: mysql-db-svc namespace: external spec: type: ExternalName externalName: 10.0.2.2 Then inside my .env for a … Read more

Mount local directory into pod in minikube

You can’t mount your local directory into your Pod directly. First, you need to mount your directory $HOME/go/src/github.com/nginx into your minikube. $ minikube start –mount-string=”$HOME/go/src/github.com/nginx:/data” –mount Then If you mount /data into your Pod using hostPath, you will get you local directory data into Pod. There is another way Host’s $HOME directory gets mounted into … Read more

Expose port in minikube

I am not exactly sure what you are asking as it seems you already know about the minikube service <SERVICE_NAME> –url command which will give you a url where you can access the service. In order to open the exposed service, the minikube service <SERVICE_NAME> command can be used: $ kubectl run hello-minikube –image=gcr.io/google_containers/echoserver:1.4 –port=8080 … Read more