Press "Enter" to skip to content

Nginx Load Balancer – How to

bist 0

When playing with k3s I had to setup a load balancer for my master nodes. Nginx would be the ideal solution for that.

The reason why we need a load balancer is because our agents/workers need to be able to communicate with any master node. You could potentially also use this for the MySql server.

Getting the config file right is key to making it work of course. Using ubuntu 20.04

This is my config file that works. So to be clear this is the whole nginx.conf file

user www-data;
worker_processes auto;
pid /run/;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;

stream {
    upstream k3s_servers {
  server {
   listen 6443;
   proxy_pass k3s_servers;

Leave a Reply

Your email address will not be published. Required fields are marked *