Configuración de red de Serverless para Apache Spark
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En este documento, se describen los requisitos necesarios para la configuración de red de Google Cloud Serverless para Apache Spark.
Requisitos de las subredes de la nube privada virtual
En este documento, se explican los requisitos de la red de nube privada virtual para las cargas de trabajo por lotes y las sesiones interactivas deGoogle Cloud Serverless for Apache Spark.
Acceso privado a Google
Las cargas de trabajo por lotes y las sesiones interactivas de Serverless for Apache Spark se ejecutan en VMs con direcciones IP internas únicamente y en una subred regional con el Acceso privado a Google (PGA) habilitado automáticamente en la subred.
Si no especificas una subred, Serverless para Apache Spark selecciona la subred default en la región de la carga de trabajo por lotes o de la sesión como la subred para una carga de trabajo por lotes o una sesión.
Si tu carga de trabajo requiere acceso a Internet o a una red externa, por ejemplo, para descargar recursos como modelos de AA desde PyTorch Hub o Hugging Face, puedes configurar Cloud NAT para permitir el tráfico saliente con IPs internas en tu red de VPC.
Conectividad de subred abierta
La subred de VPC para la región seleccionada para la carga de trabajo por lotes o la sesión interactiva de Serverless for Apache Spark debe permitir la comunicación interna de la subred en todos los puertos entre las instancias de VM.
El siguiente comando de Google Cloud CLI asocia un firewall de red a una subred que permite comunicaciones internas de entrada entre VMs con todos los protocolos en todos los puertos:
SUBNET_RANGES: Consulta Permite conexiones de entrada internas entre VMs.
La red de VPC default en un proyecto con la regla de firewall default-allow-internal, que permite la comunicación de entrada en todos los puertos (tcp:0-65535, udp:0-65535 y icmp protocols:ports), cumple con el requisito de conectividad de subred abierta. Sin embargo, esta regla también permite la entrada de cualquier instancia de VM en la red.
Serverless para Apache Spark y redes de VPC-SC
Con los Controles del servicio de VPC, los administradores de redes pueden definir un perímetro de seguridad alrededor de los recursos de los servicios administrados por Google para controlar la comunicación hacia esos servicios y entre ellos.
Ten en cuenta las siguientes estrategias cuando uses redes de VPC-SC con Serverless para Apache Spark:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eDataproc Serverless for Spark workloads and interactive sessions require a Virtual Private Cloud (VPC) subnetwork.\u003c/p\u003e\n"],["\u003cp\u003eThe selected VPC subnet must have Private Google Access enabled to ensure internal IP address functionality, and it must allow internal subnet communication on all ports between VM instances.\u003c/p\u003e\n"],["\u003cp\u003eFor workloads needing external access, you can use Cloud NAT to enable outbound traffic via internal IPs on your VPC network.\u003c/p\u003e\n"],["\u003cp\u003eWhen using VPC Service Controls (VPC-SC), you should set up private connectivity and consider using a custom container image for pre-installing dependencies outside the VPC-SC perimeter.\u003c/p\u003e\n"]]],[],null,["# Serverless for Apache Spark network configuration\n\nThis document describes the requirements needed for Google Cloud Serverless for Apache Spark\nnetwork configuration.\n\nVirtual Private Cloud subnetwork requirements\n---------------------------------------------\n\nThis document explains the Virtual Private Cloud network requirements for\nGoogle Cloud Serverless for Apache Spark batch workloads and interactive sessions.\n\n### Private Google Access\n\nServerless for Apache Spark batch workloads and interactive sessions\nrun on VMs with internal IP addresses only and on a regional subnet with\n[Private Google Access (PGA)](/vpc/docs/configure-private-google-access)\nautomatically enabled on the subnet.\n\nIf you don't specify a subnet, Serverless for Apache Spark selects the\n`default` subnet in the batch workload or session region as the subnet for a\nbatch workload or session.\n\nIf your workload requires external network or internet\naccess, for example to download resources such as ML models from\n[PyTorch Hub](https://pytorch.org/hub/) or [Hugging Face](https://huggingface.co/),\nyou can set up [Cloud NAT](/nat/docs/overview) to allow outbound traffic\nusing internal IPs on your VPC network.\n\n### Open subnet connectivity\n\nThe VPC subnet for the region selected for the\nServerless for Apache Spark batch workload or interactive session must\nallow internal subnet communication on all ports between VM instances.\n| **Note:** To prevent malicious scripts in one workload from affecting other workloads, Serverless for Apache Spark deploys [default security measures](/dataproc-serverless/docs/concepts/security).\n\nThe following Google Cloud CLI command attaches a network firewall to a\nsubnet that allows internal ingress communications among VMs using all protocols\non all ports: \n\n```\ngcloud compute firewall-rules create allow-internal-ingress \\\n --network=NETWORK_NAME \\\n --source-ranges=SUBNET_RANGES \\\n --destination-ranges=SUBNET_RANGES \\\n --direction=ingress \\\n --action=allow \\\n --rules=all\n```\n\nNotes:\n\n- \u003cvar translate=\"no\"\u003eSUBNET_RANGES:\u003c/var\u003e See\n [Allow internal ingress connections between VMs](/firewall/docs/using-firewalls#common-use-cases-allow-internal).\n The `default` VPC network in a project with the\n `default-allow-internal` firewall rule, which allows ingress communication on\n all ports (`tcp:0-65535`, `udp:0-65535`, and `icmp protocols:ports`),\n meets the open-subnet-connectivity requirement. However, this rule also allows\n ingress by any VM instance on the network.\n\n | **Use network tags to limit connectivity**. In production, the recommended practice is to limit firewall rules to the IP addresses used by your Spark workloads.\n\nServerless for Apache Spark and VPC-SC networks\n-----------------------------------------------\n\nWith [VPC Service Controls](/vpc-service-controls/docs),\nnetwork administrators can define a security perimeter around resources of\nGoogle-managed services to control communication to and between those services.\n\nNote the following strategies when using VPC-SC\nnetworks with Serverless for Apache Spark:\n\n- [Set up private connectivity](/vpc-service-controls/docs/set-up-private-connectivity).\n\n- Create a [custom container image](/dataproc-serverless/docs/guides/custom-containers)\n that pre-installs dependencies outside the VPC-SC perimeter,\n and then [submit a Spark batch workload](/dataproc-serverless/docs/guides/custom-containers#submit_a_spark_batch_workload_using_a_custom_container_image)\n that uses your custom container image.\n\nFor more information, see\n[VPC Service Controls---Serverless for Apache Spark](/vpc-service-controls/docs/supported-products#table_dataproc_serverless)."]]