How to run Docker containers on proxy ips - docker-compose

Im trying to create multiple docker containers to deploy on a VM where each container has its own proxy ip. But when i run the system the containers take the ip for the VM and not the assinged proxy ip. How do i make the containers pick up the proxy ip?

Related

MetalLB unable to reach external IP address

I have a 3 nodes Rancher RKE custom cluster deployed on Rocky Linux VMs on vSphere.
I deployed MetalLB on the cluster and define IP pool from my node network.
When I create a LoadBalancer service everything looks fine and I'm getting external IP address from the pool, however I cannot reach this IP address from the node ip network, I can't even reach it from the nodes themselves, when I try to curl to the external IP address from one of the nodes I'm getting no where (No route to host).
Curl to the cluster IP or to the pod itself works fine.
Also if I create a NodePort service to the pod I can reach it with no issue from outside the cluster.
Any ideas?

Port forward from kubernetes pod to local container

I need to connect a service running in a local container inside Docker on my machine to a database that's running on a Kubernetes cluster.
Everything I found on port forwarding allowed me to connect my machine to the cluster, but not the local container to the cluster (unless I install kubectl on my container, which I cannot do).
Is there a way to do this?
https://www.telepresence.io/ is what you're looking for. It will hook into the cluster network like a VPN and patch the services so traffic will get routed through the tunnel.

Kubernetes pod to GCP Compute Engine VM communication

How can I connect to VM's running in GCP compute engine from Kubernetes pod? I have setup a proxy server in Compute Engine and I need to use that from within pods.
This communication needs to be using internal IP. I have allowed firewall rules to allow all internal IP.
Any suggestions on how to connect from pods to gcp vm's?
You can create an internal load balancer in GCP and connect VM or you can use the VPC peering if in a different network.
If your GKE and VM are in the same network you can use the internal IP of your VM to connect with.
From inside of POD you can send curl requests to the VM over internal IP.
OR
If your GKE and GCP VM both are in the different networks you can use the VPC peering to connect both networks and use the internal IP of VM from POD.

Can we reach a server running inside kubernetes Cluster from Outside?

I have a requirement that the server that is running inside one of my container in a k8s cluster should be able to reach a server that is running in some other machine (currently its in AWS).Now the problem is that both the server (in AWS & Kubernetes Cluster) should be able to reach each other.
My server in AWS is not able to ping my Server running in Kubernetes Cluster.
Is that possible? Can we do it ?
Yes you can use ingress-nginx to create publicly reachable services ingress-nginx
If you want to do it manually you can setup load balancers that map to specific ip ranges for your nodes. This is for ssh traffic.
yes you can use ingress kubernetes object it will create publicly reachable services.
Mainly if you are using aws or digital-ocean and you will use ingress it will make load balancer (ELB or ALB) and make public service and you can access server running inside kubernetes
By manually also you can do it just simply use kubernetes service and expose it using load balancer and NODE port
https://kubernetes.io/docs/concepts/services-networking/service/

Kubernetes Pod internal communication

I have a Kubernetes cluster with 2 containers running in a single workload.
One container is running a Flask server application and the other is running an angular application. I need to have this pod set up in a way where both applications can communicate with each other within the localhost. I need the angular container which is exposed in port 4200 to communicate with the unexposed flask server which is on port 5000. I am stuck when it comes to having these containers communicate within the pod.
Rather than localhost (127.0.0.1), make sure your flask server is reachable via any local IP, that is, app.run(host='0.0.0.0').
You should be able to communicate with each other using localhost:<port-number> as all containers in a Kubernetes pod share the same network namespace.