Dynamically Update Routing Configurations through Alibaba Cloud K8S Ingress Controller

Introduction

Practical Problems

nginx -s reload
  1. It may cause certain QPS jitter and access failures.
  2. Persistent connection services are frequently disconnected.
  3. It may cause a large number of Nginx Worker processes to be in a shutting-down status, resulting in memory bloat.

Dynamic Update

# 1. Main configuration
daemon off;
worker_processes 4;
events {
# 2. Event configuration
multi_accept on;
worker_connections 1024;
use epoll;
}
http {
# 3. Http main configuration
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
upstream {
# 4. Upstream configuration
server 0.0.0.1;
}
server {
# 5. Server configuration
server_name _ ;
listen 80 default_server;
location / {
# 6. Location configuration
proxy_pass http://upstream_balancer;
}
}

Configuration Description

kubectl -n kube-system exec -it <NGINX-INGRESS-CONOTROLLER-POD-NAME> -- curl http://127.0.0.1:18080/configuration/backends
- args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-configuration
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
- --annotations-prefix=nginx.ingress.kubernetes.io
- --publish-service=$(POD_NAMESPACE)/nginx-ingress-lb
- --enable-dynamic-certificates=true ### Add this configuration
- --v=2
kubectl -n kube-system exec -it <NGINX-INGRESS-CONOTROLLER-POD-NAME> -- curl http://127.0.0.1:18080/configuration/certs
- args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-configuration
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
- --annotations-prefix=nginx.ingress.kubernetes.io
- --publish-service=$(POD_NAMESPACE)/nginx-ingress-lb
- --enable-dynamic-certificates=true ### Add this configuration
- --enable-dynamic-servers=true ### Add this configuration and enable-dynamic-certificates
- --v=2
kubectl -n kube-system exec -it <NGINX-INGRESS-CONOTROLLER-POD-NAME> -- curl http://127.0.0.1:18080/configuration/servers

Original Source

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why coding is hard?

Branch support on Business Central

Cloud Computing : A Comparative Analysis between Amazon Web Services (AWS) and Microsoft Azure

How to make a Filled-Tracked-Style Circular Progress Bar in Flutter

How to solve : “Protocol type ‘…’ cannot conform to ‘Equatable’ because only concrete types can…

Kubernetes CronJobs — Part 1: Basics

How to Install PHP on Ubuntu

Top 3 Edge Computing Platforms To Watch In The Coming Years

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Build and run microservices with Kubernetes, Helm and Skaffold locally

Accessing Pods Outside Of The Cluster In Kubernetes

What is Kubernetes?

KrakenD: How to Deploy to Kubernetes