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

Start Creating Module Using Drupal Console

Module creation using drupal console CLI

How to Use Linux File Permissions and Ownership on Alibaba Cloud ECS

Setting up a Production Docker Environment with Alibaba Container Service

How to Replicate MySQL Database on Ubuntu 16.04

Controller RequestMapping in Golang

Deploying Redis on Alibaba Cloud Container Server for Kubernetes

Acala Collaborated With Band Protocol to Release Open Oracle Gateway for Polkadot DeFi

Growbot Updates

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

Strategies for setting up K8S cluster on Local Machine

Deconstructing Elasticsearch 8

How to build Kubernetes Operators in Go

VM monitoring using Node Exporter, Prometheus and Grafana