From 58b2f39ce59f57a921ca74dbf8fbc91178ca0729 Mon Sep 17 00:00:00 2001
From: kakkotetsu <kakkotetsu@users.noreply.github.com>
Date: Mon, 7 Mar 2022 22:39:00 +0900
Subject: [PATCH] add IPv6 listen directive to nginx if
 enable_dual_stack_networks (#8596)

---
 roles/kubernetes/node/templates/loadbalancer/nginx.conf.j2 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/roles/kubernetes/node/templates/loadbalancer/nginx.conf.j2 b/roles/kubernetes/node/templates/loadbalancer/nginx.conf.j2
index 38e34aa40..fd3e5746c 100644
--- a/roles/kubernetes/node/templates/loadbalancer/nginx.conf.j2
+++ b/roles/kubernetes/node/templates/loadbalancer/nginx.conf.j2
@@ -20,6 +20,9 @@ stream {
 
   server {
     listen        127.0.0.1:{{ loadbalancer_apiserver_port|default(kube_apiserver_port) }};
+    {% if enable_dual_stack_networks -%}
+    listen        [::]:{{ loadbalancer_apiserver_port|default(kube_apiserver_port) }};
+    {% endif -%}
     proxy_pass    kube_apiserver;
     proxy_timeout 10m;
     proxy_connect_timeout 1s;
@@ -41,6 +44,9 @@ http {
   {% if loadbalancer_apiserver_healthcheck_port is defined -%}
   server {
     listen {{ loadbalancer_apiserver_healthcheck_port }};
+    {% if enable_dual_stack_networks -%}
+    listen [::]:{{ loadbalancer_apiserver_healthcheck_port }};
+    {% endif -%}
     location /healthz {
       access_log off;
       return 200;
-- 
GitLab