Ver Fonte

Update helm install ingress-nginx command

Kyle Zhang há 5 meses atrás
pai
commit
7b83397a40

+ 17 - 3
expose/expose-via-external-lb.md

@@ -149,7 +149,13 @@ tail -f /var/log/haproxy.log
    ```sh
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    kubectl create namespace ingress-nginx
-   helm install ingress-nginx ingress-nginx/ingress-nginx --set controller.service.type=NodePort --set controller.service.nodePorts.http=30080 --set controller.service.nodePorts.https=30443 --set ingressClassResource.default=true --namespace ingress-nginx
+   helm install ingress-nginx ingress-nginx/ingress-nginx \
+       --set controller.service.type=NodePort \
+       --set controller.service.nodePorts.http=30080 \
+       --set controller.service.nodePorts.https=30443 \
+       --set ingressClassResource.default=true \
+       --set controller.watchIngressWithoutClass=true \
+       --namespace ingress-nginx
    ```
 
 2. **配置防火墙**:
@@ -161,7 +167,7 @@ tail -f /var/log/haproxy.log
 3. **检查 Nginx Ingress Controller 配置**:
 
    ```sh
-   kubectl get configmap -n ingress-nginx ingress-nginx-controller -o yaml
+   kubectl get configmap -n ingress-nginx ingress-nginx-controller -o yaml > nginx-configmap.yaml
    ```
 
 4. **确认配置**:
@@ -183,7 +189,15 @@ tail -f /var/log/haproxy.log
    ```sh
    kubectl apply -f nginx-configmap.yaml
    ```
-
+   
+   或者通过 patch 方式更新:
+   
+   ```
+   kubectl -n ingress-nginx patch configmaps ingress-nginx-controller -p '{"data": {"use-proxy-protocol": "true"}}'
+   ```
+   
+   
+   
 5. **重启 Nginx Ingress Controller**:
 
    重新启动 Nginx Ingress Controller 以使配置更改生效:

+ 6 - 1
expose/expose-via-hostnetwork.md

@@ -11,7 +11,12 @@
    ```sh
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    kubectl create namespace ingress-nginx
-   helm install ingress-nginx ingress-nginx/ingress-nginx --set controller.kind=DaemonSet --set controller.hostNetwork=true --set ingressClassResource.default=true --namespace ingress-nginx
+   helm install ingress-nginx ingress-nginx/ingress-nginx \
+       --set controller.kind=DaemonSet \
+       --set controller.hostNetwork=true \
+       --set ingressClassResource.default=true \
+       --set controller.watchIngressWithoutClass=true \
+       --namespace ingress-nginx
    ```
 
 ### 2. **端口冲突**:

+ 16 - 10
expose/expose-via-kubelet-nodeport.md

@@ -33,14 +33,22 @@
 
 ### 3. **部署 Nginx Ingress Controller**:
 
-   使用 Helm 安装 Nginx Ingress Controller,将其 Service NodePort 端口设置为 80 和 443。
+使用 Helm 安装 Nginx Ingress Controller,将其 Service NodePort 端口设置为 80 和 443。
 
 为了确保客户端的真实 IP 地址能够在 NodePort 类型的服务中正确传递,你需要将 `externalTrafficPolicy` 设置为 `Local`。这将确保源地址转换(source IP preservation)在负载均衡到具体的节点上时得到应用。
 
    ```sh
 helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
 kubectl create namespace ingress-nginx
-helm install ingress-nginx ingress-nginx/ingress-nginx --set controller.kind=DaemonSet --set controller.service.type=NodePort --set controller.service.nodePorts.http=80 --set controller.service.nodePorts.https=443 --set controller.service.externalTrafficPolicy=Local --set ingressClassResource.default=true --namespace ingress-nginx
+helm install ingress-nginx ingress-nginx/ingress-nginx \
+    --set controller.kind=DaemonSet \
+    --set controller.service.type=NodePort \
+    --set controller.service.nodePorts.http=80 \
+    --set controller.service.nodePorts.https=443 \
+    --set controller.service.externalTrafficPolicy=Local \
+    --set ingressClassResource.default=true \
+    --set controller.watchIngressWithoutClass=true \
+    --namespace ingress-nginx
    ```
 
 ### 4. 配置 Ingress Controller 以支持 Proxy Protocol
@@ -73,6 +81,12 @@ data:
 kubectl apply -f nginx-configmap.yaml
 ```
 
+或者通过 patch 方式更新:
+
+```
+kubectl -n ingress-nginx patch configmaps ingress-nginx-controller -p '{"data": {"use-proxy-protocol": "true"}}'
+```
+
 **步骤 3:重启 Nginx Ingress Controller**
 
 重新启动 Nginx Ingress Controller 以使配置更改生效:
@@ -99,11 +113,3 @@ kubectl rollout restart deployment ingress-nginx-controller -n ingress-nginx
 
 
 
-
-
-
-
-
-
-
-

+ 6 - 1
expose/expose-via-metallb.md

@@ -119,7 +119,12 @@ MetalLB 提供两种主要的地址发布模式:
 ```sh
 helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
 kubectl create namespace ingress-nginx
-helm install ingress-nginx ingress-nginx/ingress-nginx --set controller.service.type=LoadBalancer --set controller.service.externalTrafficPolicy=Local --set ingressClassResource.default=true --namespace ingress-nginx
+helm install ingress-nginx ingress-nginx/ingress-nginx \
+    --set controller.service.type=LoadBalancer \
+    --set controller.service.externalTrafficPolicy=Local \
+    --set ingressClassResource.default=true \
+    --set controller.watchIngressWithoutClass=true \
+    --namespace ingress-nginx
 ```
 
 1. **验证服务暴露**: