0

I'm trying to set up Load balancing to my cluster that I created via container engine but I keep getting 502 Server Error.

Here is what I do.

  1. I make sure that my service really runs taking this ip in kubernetes dashboard enter image description here

  2. I have only one instance group. So this belongs cluster enter image description here

  3. 80 port is open for every instance in Firewall rules

  4. I created a load balancer with this configuration. As you can see I set the only instance group I got, also I set up health check. The health check is http endoint /api/ping/ that returns HTTP 200 with body "pong". But I keep getting 502 ERROR. I understand it happens because health check doesn't pass. Apperently it's because when load balancer is sending request it's sending directly to instances, instead of to docker containers. If I go by ip of vm isntance where I host my cluster I will get nothing as well. enter image description here

I want to do it so I could switch traffic between different clusters If I decide to create a new one, also I would be able to balance https traffic.

Artem Ibragimov
  • 463
  • 3
  • 17

1 Answers1

0

Maybe it will help someone so I will post the answer.

I created my pods via UI kubernetes using their consructor-form. When I used this form ports were not exposed to the host machine(Even I marked them as External ports). I wrote an yaml config and exposed ports there to host machine. After this balancer started working. I used this block to expose 80 port to host machine

ports:
  - containerPort: 80
  hostPort: 80
  protocol: TCP
Artem Ibragimov
  • 463
  • 3
  • 17