How can I securely connect to databases in GKE using GUI tools? - mysql

I'd like to connect to my databases in GKE using GUI tools but I don't want to expose the services to the world. What are some ways to accomplish this?
Update: for instance, I'd like to use TablePlus to connect to a mysql pod inside the cluster.

Create a new VM in the region where your cluster lives.
Install the GUI tool.
Specify an IP address in the cluster's IP range.
See the example below, which describes how to connect to a database which is running on a GKE cluster.
https://cloud.google.com/composer/docs/access-airflow-database

Related

Connecting to MySQL server via kubernetes pod using Intellij

We have a MySQL server that is running on AWS using AWS RDS service and some Kubernetes pods which run some services that connect to this MySQL instance.
I have been using Intellij Idea (2020.1) to connect to these MySQL servers for quite some time. However, recently we have changed the policy to connect to these instances, and now it's only possible to connect to the MySQL servers from the Kubernetes pods. Hence, I now need to login to these pods and then query MySQL using the command-line MySQL-client.
Is there any way I can still use Intellij to connect to these MySQL instances than having to log in to the pods using something like SSH tunnelling or something like that?
Yes, setting up an SSH tunnel is recently straight forwards, but the setup depends on your VPC and EC2 configuration. There are a lot of how-tos on the net, e.g.: https://medium.com/#michalisantoniou6/connect-to-an-aws-rds-using-an-ssh-tunnel-22f3bd597924

elastic beanstalk docker app cannot connect to mysql

I have an ElasticBeanstalk application that uses Docker to run a small Laravel PHP API.
The app cannot connect to MySQL when running in ElasticBeanstalk.
The MySQL DB is a publically available AWS RDS instance.
I've run my Docker container locally and the app can connect just fine.
When I deploy to ElasticBeanstalk the app cannot connect...
Can anyone point me in a direction to help debug this?
SOLUTION
For anyone else who stumbles on this:
The solution was to create a new security group for both the EC2 instances and the RDS database. The two security groups opened up access via port 3306 for the instances and the database.
I also ensured the EC2 instances were available across every subnet and in the same VPC as my database.
Taken from the answers below and bit of help from a SysOps friend of mine.
You may want to check the EC2 Security Group Rules attached to Elastic Beanstalk to allow TCP at port 3306 for MYSQL type.
High chance that your ec2 instance does not have a public ip assigned to it. If you're trying to connect to the public IP of RDS without a public ip on the ec2 instance you won't be able to.
The ec2 instance will either need a public ip or it will need to have external internet connectivity through NAT.

Can Amazon AWS RDS MySQL databases be used in Azure?

We have mysql databases which we want to host on AWS RDS and want to use in Azure VM and web app. Both of them located in Singapore region.
Is this possible? If yes, How? What are pros and cons? And how to do this?
You have two options, build a Amazon VPC /Azure Network VPN tunnel by your own, with something like a cisco instance or linux vpn packages, or make your mysql amazon rds public accessible and set up ssl encrypt connection to the db for more information see this doc
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html

run multiple mysql pods in kubernetes

I would like to create a kubernetes cluster to deploy mysql databases, like a mysql farm. These databases should be accessible from internet.
All databases on the same node will have the port 3306 listening, the kube-proxy or the DNS addon could redirect each request to an specific container?
I would like to create url's like myDB1.example.com:3306, myDB2.example.com:3306 that goes to an specific container.
I'm deploying this environment in AWS.
It's possible to create this cluster?
Yes. Starting point would be a (customized) MySQL Docker image with EBS backed volumes and you'd be using it in an Replication Controller to handle failover. On top of that you would have a Service that provides a stable and routable interface to the outside world. Optionally, put an AWS Elastic Load Balancer in front of it.

Custom Amazon EC2 instance and managing MySQL

so I've made an instance at amazon free web service, I've installed through putty mysql, php5, apache and so on on an ubuntu instance... But I can't for the life of me seem to find out how to manage the mysql on that instance. What am I missing? If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
As you have installed MySQL in the EC2 instance you can manage it via terminal.
Login to your instance using putty/ssh and connect to MySQL using below command
mysql --user=username --password=password
you need to install MySQL client if you installed on only MySQL Server.
If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
Yes, RDS is a service where Amazon manages the entire database box for you. The AWS Console manages (paid) RDS instances, not databases in general.
But I can't for the life of me seem to find out how to manage the mysql on that instance.
The "normal" way. Amazon doesn't come with CPanel or other GUI administration tools. Mainly because experts don't need them.
If you want to manage your MySQL graphically, install something like PHPMySQLAdmin or the like.
Note: never open the MySQL port to the internet. If you need to connect to MySQL, use "port forwarding" in Putty to forward port 3306 to the remote box port 3306. Then you can run a MySQL GUI client locally.