Score:0

What database my applications will use if I have a locally installed database beside it's pod running on local Kubernetes?

pl flag

I have installed mysql on my Ubuntu machine. I also have a locally running Kubernetes and deployed a mysql deployment on Kubernetes and can reach to that using kubectl exec -it mysql-b4769786-5hf4m sh command, then mysql -p.

I am a little confused now. I don't know do I have two separated databases, one running locally on my OS and the other one also runs locally but upon my Kubernetes cluster? If so, how can I reach to each of them? How should I know the shell I am working with is connected to Kubernetes mysql or my OS mysql?

Or when I write a NodeJS app, will that connect to the mysql installed on Ubuntu or mysql pod is running on local Kubernetes?

Score:1
my flag

You indeed have two different databases. The container could even have an entirely different operating system (base image).

You can double check by running a simple test:

  • create a "container" database inside the MySQL container

  • run SHOW DATABASES; on the other MySQL instance. You shouldn't find anything.

Score:1
tv flag

You have two mysql database: one on you Ubuntu machine and another one in kubernetes BUT If you want to use mysql on kubernetes from your Ubuntu machine you need to create a Nodeport. If you do not expose mysql service your local application on your Ubuntu machine is unable to connect to kubernetes mysql pod. If you expose mysql pod use another port to avoid mysql problems.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.