A
A
Alexey Verkhovtsev2020-05-31 18:21:36
Kubernetes
Alexey Verkhovtsev, 2020-05-31 18:21:36

How does communication work in kubernetes?

Hello! There is a lot of information and I either understood it correctly or not
. My vision of communications.
We have 3 participants that must communicate:

Server1 is listening on port 8080, a Demployment has been created for it and a service (svc1) of type ClusterIP has been created for the service, the port field is set to 8080

Server2 needs to connect to the server in order to perform some work, but the client also accepts requests on port 7070, a Deployment was also created for it, in the env of the container I pass the svc1 host and port 8080 to connect to the first server. Next, I create a service (svc2), such as ClusterIP with a port 7070 field

. Thus, 2 services can communicate (I don’t know if this is the right approach)

Next, another participant in the work is server3, which in general should receive requests from the user and coordinate the work, I create a new Deployment, pass the svc2 host and port 7070 to the container env to connect to server2. Server 3 is listening on port 6060, a service (svc3) of type LoadBalancer has been created for it, with the field port 80, targetPort 6060 and the name of the service (let it be gateway).

Next, I create an Ingress that refers to the svc3 service by the name gateway and it will have something like this
backend in the rules:
serviceName: gateway
servicePort: 80

Do I understand what is happening correctly or not? Or am I missing something. I apologize in advance for such a stupid question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pugachev, 2020-06-01
@seftomsk

It would be better for you to immediately lay out yaml so that it would be clearer.
In principle, everything is correct. It is not necessary to give unique ports to services.
If you have google cloud or avs then it is not necessary to create an ingress. A service with type LoadBalancer will suffice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question