Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 10 - Set Up Nginx Load Balancer For Kubernetes

The tutorial below is how I set up my load balancer on Debian 10 for Kubernetes.


I deployed a VPS with 2 vCPUs and 512 MB of RAM.


Install Nginx

sudo apt update && sudo apt install nginx -y

Now replace your Nginx configuration using the command below. Be sure to change the IP addresses of the k3s_servers block as appropriate for your Kubernetes API servers.

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

events {}

stream {
    upstream k3s_servers {

    server {
        listen 6443;
        proxy_pass k3s_Servers;
}" | sudo tee /etc/nginx/nginx.conf

Reload Nginx:

sudo nginx -s reload


Last updated: 24th June 2021
First published: 23rd June 2021