NGINX as external LB for K8S HA

(nginx config below)
Hello everyone,

Im having issues with creating high availabilty cluster.
I have four machines - load balancer with NGINX and three Control Planes.

According to K8S official documentation, I need to make connection between LB and one cluster (Control Plane 0).
After spending some time on NGINX configuration it still cannot forward https traffic to first cluster.
Do I have to do some configuration on K8S side? For example kube-api needs some work to be done?

Thank you for any help in this case.


events {}
http {
upstream k8s-ingress {
    server ingress0_ip:31989;
    server ingress1_ip:31989;
    server ingress_2_ip:31989;
}

upstream k8s-masters {
   server master0_ip:6443;
   server master1_ip:6443;
   server master2_ip:6443;
}

#server {
#    listen 80;
#    server_name load_balancer_dns;
#    return 301 $scheme://load_balancer_dns$request_uri;
#    location / {
#        proxy_pass http://k8s-ingress;
#
#        # proxy_ssl_certificate         /etc/nginx/client.pem;
#        proxy_ssl_certificate_key     /etc/nginx/ssl/lb.key;
#        proxy_ssl_trusted_certificate /etc/nginx/ssl/lb.crt;
#
#        proxy_ssl_verify        on;
#        proxy_ssl_verify_depth  2;
#        proxy_ssl_session_reuse on;
#    }
#}

server {
    listen 443 ssl;
    server_name load_balancer_dns;
    ssl_certificate /etc/nginx/ssl/lb.crt;
    ssl_certificate_key /etc/nginx/ssl/lb.key;

    location / {
        proxy_pass https://k8s-masters;

        # proxy_ssl_certificate         /etc/nginx/client.pem;
        proxy_ssl_certificate_key     /etc/nginx/ssl/lb.key;
        proxy_ssl_trusted_certificate /etc/nginx/ssl/lb.crt;

        proxy_ssl_verify        on;
        proxy_ssl_verify_depth  2;
        proxy_ssl_session_reuse on;
    }
}
}