이 문서에서는 부하 분산에 사용할 두 가지 Dataplan V2 전달 모드와 Google Distributed Cloud에 사용 설정하는 방법을 설명합니다. Dataplane V2는 부하 분산에 두 가지 전달 모드를 지원합니다.
소스 네트워크 주소 변환(SNAT)
직접 서버 반환(DSR)
클러스터를 만들 때만 부하 분산 전달 모드를 구성할 수 있습니다.
SNAT 부하 분산
소스 네트워크 주소 변환(SNAT)이 Dataplane V2 부하 분산용 기본 전달 모드입니다. 그러나 SNAT 모드에서는 클라이언트 IP 주소가 백엔드 포드에 보존되지 않습니다. 클라이언트의 패킷이 부하 분산기 노드에 도달하면 변환되어 백엔드 포드가 있는 대상 워커 노드로 전달됩니다. 백엔드 포드는 요청이 클라이언트 위치 대신 부하 분산기 노드에서 들어오는 것을 확인합니다. 따라서 응답이 부하 분산기 노드로 반환되고 역변환되어 클라이언트에 다시 전송됩니다.
SNAT 패킷 흐름
Dataplane V2 부하 분산용 SNAT 전달 모드를 사용하면 외부 클라이언트에서 백엔드 포드로의 패킷 흐름은 다음과 같습니다.
LoadBalancer 유형의 서비스가 부하 분산기 노드에 할당되고 IP 주소 172.16.20.16이 해당 노드에서 실행되는 MetalLB 스피커에 공지됩니다.
Dataplane V2는 SNAT가 있는 소스 IP 주소와 포트를 <LB_NODE_IP>:52000으로 변환하고 패킷을 워커 노드로 전달합니다.
응답이 부하 분산기 노드로 다시 전송되고 대상 주소가 역변환됩니다.
다음 다이어그램에서는 SNAT 모드의 패킷 흐름을 보여줍니다.
DSR 부하 분산
직접 서버 반환(DSR)은 SNAT 부하 분산 문제를 해결합니다. DSR 모드에서 부하 분산기 노드는 IP 옵션을 사용하여 클라이언트 소스 주소를 저장합니다.
워커 노드는 원래 패킷을 복구하고 백엔드 포드로 전달할 수 있습니다. 백엔드 포드는 패킷이 부하 분산기 노드 IP 주소 대신 클라이언트 IP 주소에서 들어오는 것을 확인할 수 있습니다. 따라서 반환 패킷은 부하 분산기 노드로 다시 이동하는 대신 클라이언트 IP 주소로 직접 반환됩니다.
이 모드는 클라이언트 IP 주소 공개 상태 문제를 해결할 뿐만 아니라 부하 분산기 노드의 대역폭도 저장합니다. 반환 트래픽은 부하 분산기 노드를 통과할 필요가 없으며 부하 분산기 노드에서 더 이상 연결 추적을 수행할 필요가 없습니다. 이 방식은 메모리를 절약하고 전달 포트를 확보합니다. 다운로드 트래픽이 요청 트래픽보다 훨씬 높은 비대칭 워크로드의 경우 DSR 흐름은 대역폭을 크게 줄입니다.
DSR 패킷 흐름
Dataplane V2 부하 분산용 DSR 전달 모드를 사용하면 외부 클라이언트에서 백엔드 포드로의 패킷 흐름은 다음과 같습니다.
LoadBalancer 유형의 서비스가 부하 분산기 노드에 할당되고 IP 주소 172.16.20.16이 해당 노드에서 실행되는 MetalLB 스피커에 공지됩니다.
Dataplan V2는 패킷을 워커 노드로 전달하고 IP 옵션을 사용하여 원래 클라이언트 소스 IP 주소와 포트를 저장합니다.
워커 노드의 Dataplane V2에서 패킷을 백엔드 포드로 전달합니다.
백엔드 포드에서 소스 IP 주소와 포트를 복구하고 클라이언트에 응답합니다.
다음 다이어그램에서는 DSR 모드의 패킷 흐름을 보여줍니다.
DSR 모드 사용 설정
DSR 모드를 사용 설정하려면 spec.clusterNetwork.forwardMode 필드를 클러스터 구성 파일에 추가하고 dsr로 설정합니다. 앞에서의 설명처럼 SNAT 모드는 기본적으로 사용 설정됩니다. forwardMode를 snat으로 설정하여 SNAT 모드를 명시적으로 지정할 수 있습니다. 클러스터를 만들 때에만 Dataplane V2 부하 분산 네트워킹 모드를 구성할 수 있습니다.
apiVersion:baremetal.cluster.gke.io/v1kind:Clustermetadata:name:lb-modenamespace:cluster-lb-mode...spec:clusterNetwork:forwardMode:dsr# valid options are dsr or snatpods:cidrBlocks:-192.168.0.0/16services:cidrBlocks:-10.96.0.0/20...
클러스터가 생성된 후에는 forwardMode 값을 수정할 수 없습니다. 클러스터를 만들기 전에 필요에 맞는 올바른 옵션을 구성했는지 확인합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-01(UTC)"],[],[],null,["This document describes the two Dataplane V2 forwarding modes for load balancing\nand how to enable them for Google Distributed Cloud. Dataplane V2 supports two\nforwarding modes for load balancing:\n\n- Source network address translation (SNAT)\n- Direct Server Return (DSR)\n\nThe forwarding mode for load balancing can be configured when you create a\ncluster only.\n\nSNAT load balancing\n\nSource network address translation (SNAT) is the default forwarding mode for\nDataplane V2 load balancing. However, in SNAT mode, the client IP address isn't\npreserved for backend Pods. When the packet from the client arrives at the load\nbalancer node, it's translated and forwarded to the destination worker node with\nthe backend Pod. The backend Pod sees that the request is coming from the load\nbalancer node, instead of the client location. As a result, the reply is\nreturned to the load balancer node and reversed translated and sent back to the\nclient.\n\nPacket flow for SNAT\n\nWith SNAT forwarding mode for Dataplane V2 load balancing, here's the packet\nflow from an external client to a backend Pod and back:\n\n- Service of type LoadBalancer is assigned to a load balancer node and its IP\n address `172.16.20.16` is advertised by the MetalLB speaker running on that\n node.\n\n- Dataplane V2 translates the source IP address and port with SNAT to\n `\u003cLB_NODE_IP\u003e:52000` and forwards the packet to the worker node.\n\n- The response is sent back to the load balancer node and the destination\n address is reverse translated.\n\nThe following diagram shows the packet flow for SNAT mode:\n\nDSR load balancing\n\nDirect Server Return (DSR) overcomes issues with SNAT load balancing. In DSR\nmode, the load balancer node uses IP Options to save the client source address.\nThe worker node can recover the original packet and forward it to the backend\nPod. The backend Pod can see that the packet is coming from client IP address\ninstead of the load balancer node IP address. As a result, the return packet\ndirectly returns to the client IP address instead of traveling back to the load\nbalancer node.\n\nThis mode not only solves the client IP address visibility problem, it also\nsaves the bandwidth for the load balancer node. Return traffic doesn't have to\ngo through the load balancer node, and the load balancer node doesn't have to do\nconnection tracking anymore. This approach saves memory and frees the forwarding\nport. For asymmetric workloads, where download traffic is much higher than\nrequest traffic, the DSR flow reduces bandwidth significantly.\n\nPacket flow for DSR\n\nWith DSR forwarding mode for Dataplane V2 load balancing, here's the packet flow\nfrom and external client to a backend Pod and back:\n\n- Service of type LoadBalancer is assigned to the load balancer node and its\n IP address `172.16.20.16` is advertised by the MetalLB speaker running on\n that node.\n\n- Dataplane V2 forwards the packet to the worker node and uses IP Options to\n save the original client source IP address and port.\n\n- Dataplane V2 on the worker node forwards the packet to the backend Pod.\n\n- The backend Pod recovers the source IP address and port and replies to the\n client.\n\nThe following diagram shows the packet flow for DSR mode:\n\nEnable DSR mode\n\nTo enable DSR mode, add the\n[`spec.clusterNetwork.forwardMode`](/kubernetes-engine/distributed-cloud/bare-metal/docs/reference/cluster-config-ref#clusternetwork-forwardmode)\nfield to your cluster configuration file and set it to `dsr`. As noted earlier,\nSNAT mode is enabled by default. You can specify SNAT mode explicitly by setting\n`forwardMode` to `snat`. The forwarding mode for Dataplane V2 load balancing can\nbe configured at cluster creation time only.\n| **Note:** For version 1.16 clusters, the ability to configure Dataplane V2 forwarding mode for load balancing is a ([Preview](/products#product-launch-stages)) capability. While in Preview, this feature uses an annotation `preview.baremetal.cluster.gke.io/dpv2-lbmode-dsr:\nenable` to enable DSR mode. For cluster upgrades from version 1.16 to 1.28.0 and higher, Google Distributed Cloud honors the annotation and sets `forwardMode` in the cluster spec accordingly. \n\n apiVersion: baremetal.cluster.gke.io/v1\n kind: Cluster\n metadata:\n name: lb-mode\n namespace: cluster-lb-mode\n ...\n spec:\n\n clusterNetwork:forwardMode: dsr # valid options are dsr or snat\n pods:\n cidrBlocks:\n - 192.168.0.0/16\n services:\n cidrBlocks:\n - 10.96.0.0/20\n ...\n\nThe `forwardMode` value can't be modified after the cluster is created. Make sure you've\nconfigured the correct option for your needs before you create the cluster."]]