We have a docker swarm setup on four aws ec2 ubuntu machines. Two of them acting as managers.
Now, instead of managing ourselves, we want to port to a managed service like aks/eks for kubernetes.
I am not able to find any so far, so thought to migrate our work loads to kubernetes.
As part of that, we are running docker service command for different databases so that whenever a test database is required(postgres,oracle,mysql,etc) we run a command in docker swarm to create a service and we get a random port which we connect using the manager public ip.
Example:
for postgres:
docker service create --name postgres_31 -p target=5432 -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=admin -e POSTGRES_DB=testdb -d postgres:9.6.18
The above will create a random port for postgres for 5432 port
like below it generated 30048
So, the user connects with public ip of manager node and port 30048 which will redirect to 5432 port of database.
docker service ls
p45fazswicxc postgres_31 replicated 1/1 postgres:13 *:30048->5432/tcp
In this way, we used to create multiple databases of postgres (or other databases) on swarm (for testing purposes for dev team).
How to replicate this environment on kubernetes?
In kubernetes, it seems it generates separate public IP for the load balancer type service for each deployment, but we need a single one. I thought of keeping an azure load balancer externally and redirect all, but the configuration is for http only I guess and can be only for a single port not with multiple random ports, correct me if I am wrong.
0 Answers