<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] Kubernetes 集群中, 在 Kube Proxy 里大量用到了 iptables, 在 Kubernetes 集群規模較大的情況下, 數以千/萬計的 iptables 規則會極大地拖慢 Kubernetes 網絡性能, 導致網絡請求響應緩慢. # Kube Proxy 的用途 Kube Proxy 的負責以下幾個方面的流量路由: 1. ClusterIP: 集群內通過 ClusterIP 的訪問 2. NodePort: 集群內外通過 NodePort 的訪問 3. ExternalIP: 集群外通過 external IP 的訪問 4. LoadBalancer: 集群外通過 LoadBalancer 的訪問. 以上功能 cilium 均已實現,并且性能更加強悍。 # cilium與kubeProxy性能對比 Cilium 完全實現了 kube-proxy 功能, 并做到了性能上有所提升, 具體 [Cilium 官方測試結果](https://cilium.io/blog/2019/08/20/cilium-16/) >[info] 下圖顯示了通過 Kubernetes 服務發送到遠程主機上運行的 nginx Pod 的每個 HTTP GET 請求的延遲(越低越好),使用 `ab` 發送 100,000 個連續請求來測量。 正如我們所看到的,eBPF 服務實現不依賴于集群中部署的服務數量,而使用 iptables 的 kube-proxy 實現卻依賴于集群中部署的服務數量。 ![](https://cilium.io/static/81bd650b0c6e51860472f409e3c03d37/21910/k8s-service-benchmark.png) 在 [Google文檔](https://docs.google.com/presentation/d/1cZJ-pcwB9WG88wzhDm2jxQY4Sh8adYg0-N3qWQ8593I/edit?pli=1#slide=id.g708c5740c0_0_216) 找到提及多個轉發(iptables, ipvs, eBPF)方式對比結果。該文檔創建者也是撰寫 [cilium官網替換kube-proxy性能提升](https://cilium.io/blog/2019/08/20/cilium-16/) 的兩位測試之中的一員。數據估計是可靠的 ![](https://img.kancloud.cn/4a/68/4a6828f17d60edc7312592fe80bf0d8a_911x487.png) >[info] 從這個結果來看,kubeProxy中 ipvs 模式與 eBPF 相差不遠。兩者都不會跟隨 Service 增加而降低性能 # 實施 cilium 替換 kube-proxy ## 前提條件 - Cilium 的 kube-proxy 替換依賴于 socket-LB 功能,這需要 v4.19.57、v5.1.16、v5.2.0 或更高版本的 Linux 內核 ## 逐步替換節點 1. kube-proxy 設置節點反親和性 ```shell $ kubectl -n kube-system patch daemonset kube-proxy --patch '{"spec": {"template": {"spec": {"affinity": {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "io.cilium.migration/kube-proxy-replacement", "operator": "NotIn", "values": ["strict"]}]}]}}}}}}}' ``` 2. 設置cilium節點配置 ```shell $ cat <<EOF | kubectl apply --server-side -f - apiVersion: cilium.io/v2alpha1 kind: CiliumNodeConfig metadata: namespace: kube-system name: kube-proxy-replacement-strict spec: nodeSelector: matchLabels: io.cilium.migration/kube-proxy-replacement: strict defaults: kube-proxy-replacement: strict kube-proxy-replacement-healthz-bind-address: "0.0.0.0:10256" EOF ciliumnodeconfig.cilium.io/kube-proxy-replacement-strict serverside-applied ``` 3. 節點禁止調度 ```shell $ export NODE=192.168.32.127 $ kubectl cordon $NODE ``` 4. 節點設置label ```shell $ export NODE=192.168.32.127 $ kubectl label node $NODE --overwrite 'io.cilium.migration/kube-proxy-replacement=strict' ``` 5. 重啟cilium ```shell $ export NODE=192.168.32.127 $ kubectl -n kube-system delete pod -l k8s-app=cilium --field-selector spec.nodeName=$NODE ``` 6. 確認cilium啟動參數 ```shell $ export NODE=192.168.32.127 $ kubectl -n kube-system exec $(kubectl -n kube-system get pod -l k8s-app=cilium --field-selector spec.nodeName=$NODE -o name) -c cilium-agent -- cilium config get kube-proxy-replacement $ kubectl -n kube-system exec $(kubectl -n kube-system get pod -l k8s-app=cilium --field-selector spec.nodeName=$NODE -o name) -c cilium-agent -- cilium status --verbose ... KubeProxyReplacement Details: Status: Strict Socket LB: Enabled Socket LB Tracing: Enabled Socket LB Coverage: Full Devices: ens33 192.168.32.127 Mode: SNAT Backend Selection: Random Session Affinity: Enabled Graceful Termination: Enabled NAT46/64 Support: Disabled XDP Acceleration: Disabled Services: - ClusterIP: Enabled - NodePort: Enabled (Range: 30000-32767) - LoadBalancer: Enabled - externalIPs: Enabled - HostPort: Enabled ... ``` 7. 節點運行調度 ```shell $ export NODE=192.168.32.127 $ kubectl uncordon $NODE ``` 8. 逐步替換其他節點 替換其他節點,只需從第 `3-7` 步執行。將 NODE 變量改成需要替換的k8s節點名稱 9. 修改cilium配置文件 >[info] 集群中所有節點都替換完成后才執行此步驟 ```shell # 獲取當前版本號 cilium_version=$(helm -n kube-system ls | awk '/cilium/ {print $NF}') echo $cilium_version # 備份上一次安裝的參數 helm -n kube-system get values cilium > cilium_custom.yaml sed -i '1d' cilium_custom.yaml # 添加參數 cat <<EOF | tee -a cilium_custom.yaml >> /dev/null # 在 Cilium BPF 數據路徑中配置 kube-proxy 替換 kubeProxyReplacement: "strict" # 用于 kube-proxy 替換的 healthz 服務器綁定地址 kubeProxyReplacementHealthzBindAddr: "0.0.0.0:10256" EOF # 修改參數 helm -n kube-system upgrade cilium cilium/cilium --version $cilium_version -f cilium_custom.yaml ``` 10. 刪除cilium節點配置 ```shell $ kubectl -n kube-system delete ciliumnodeconfig kube-proxy-replacement-strict ``` 11. 卸載kube-proxy服務 ```shell $ kubectl -n kube-system delete ds kube-proxy $ kubectl -n kube-system delete cm kube-proxy $ iptables-save | grep -v KUBE | iptables-restore ``` 12. 取消節點 label 標簽 ```shell $ kubectl label node --all --overwrite 'io.cilium.migration/kube-proxy-replacement-' ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看