Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Se la tua organizzazione utilizza un proxy HTTP per il traffico internet, devi configurare di conseguenza i cluster collegati a GKE. Questo documento descrive come eseguire questa configurazione.
Prima di iniziare
I cluster collegati a GKE richiedono la connettività a vari Google Cloud servizi. Assicurati che il server proxy consenta il traffico verso i seguenti domini:
.gcr.io
cloudresourcemanager.googleapis.com
container.googleapis.com
gkeconnect.googleapis.com
gkehub.googleapis.com
oauth2.googleapis.com
securetoken.googleapis.com
storage.googleapis.com
sts.googleapis.com
www.googleapis.com
servicecontrol.googleapis.com
logging.googleapis.com
monitoring.googleapis.com
opsconfigmonitoring.googleapis.com
GCP_LOCATION-gkemulticloud.googleapis.com
Sostituisci GCP_LOCATION con la Google Cloud regione in cui risiede il tuo cluster. Specifica us-west1 o un'altra
regione supportata.
Configura il supporto del proxy per i cluster collegati a GKE
Per configurare il supporto del proxy per i cluster GKE collegati, segui questi passaggi:
Crea un file di configurazione del proxy contenente i valori per le chiavi httpProxy,
noProxy e httpsProxy:
HTTP_PROXY_AUTHENTICATION_URL: l'URL del server proxy, costituito da un nome host/indirizzo IP e, facoltativamente, da una porta, un nome utente e una password. Ad esempio: http://user:password@192.0.2.0:80 o
solo 198.51.100.255.
HTTPS_PROXY_AUTH_URL: l'URL del proxy per il traffico HTTPS criptato, costituito da un nome host/indirizzo IP e, facoltativamente, da una porta, un nome utente e una password.
NO_PROXY_ADDRESSES: un elenco separato da virgole di URL, blocchi CIDR e nomi DNS di risorse che possono bypassare il proxy.
In questo modo, i cluster GKE collegati eviteranno di utilizzare il proxy per le risorse specificate. Tieni presente quanto segue:
I valori possono essere singoli indirizzi IP, intervalli CIDR, nomi di dominio o persino il carattere asterisco (*). L'utilizzo di un singolo asterisco (*) nel campo noProxy indica ai cluster GKE collegati di saltare il proxy per tutto il traffico.
Un dominio che inizia con un punto, ad esempio .google.com, ha come target tutti i suoi
sottodomini. Ad esempio, .google.com include indirizzi come
mail.google.com e drive.google.com, ma esclude google.com.
Assicurati di includere i domini kubernetes.default.svc.cluster.local e
kubernetes.default.svc per la registrazione corretta. Ecco un esempio:
198.51.100.0,192.0.2.0/16,examplepetstore.com,.altostrat.com,kubernetes.default.svc.cluster.local, kubernetes.default.svc.
Quando crei il file di configurazione del proxy, rispetta le seguenti linee guida:
I campi httpProxy e httpsProxy non accettano prefissi https://.
Utilizza http://, anche se l'indirizzo del server proxy reale inizia con https://.
Ad esempio, rappresenta https://proxy.example.com:3128 come
http://proxy.example.com:3128.
È obbligatorio fornire valori per tutti e tre i campi: httpProxy,
httpsProxy e noProxy.
Valuta la possibilità di aggiungere altri domini, indirizzi IP o CIDR all'elenconoProxy. Ti consigliamo di includere l'intervallo IP del VPC.
Crea un secret di Kubernetes contenente la configurazione del proxy eseguendo il seguente comando:
PROXY_CONFIGURATION_FILE: il percorso alla configurazione del proxy creata nel passaggio 1.
Contrassegna il secret Kubernetes come
immutable
impostando il relativo campo immutable su true:
kubectleditsecretSECRET_NAME
Sostituisci SECRET_NAME con il nome del segreto Kubernetes.
Configura un cluster nuovo o esistente per utilizzare il proxy:
Nuovo cluster
Per registrare un nuovo cluster e applicare la configurazione del proxy, utilizza il
comando gcloud container attached clusters register. Assicurati di fornire gli argomenti facoltativi
--proxy-secret-name e --proxy-secret-namespace:
Per aggiornare un cluster registrato in precedenza con una nuova configurazione del proxy,
utilizza il
comando gcloud container attached clusters update. Assicurati di fornire gli argomenti facoltativi --proxy-secret-name
e --proxy-secret-namespace:
SECRET_NAME: il nome del secret Kubernetes contenente la configurazione del proxy
SECRET_NAMESPACE: lo spazio dei nomi Kubernetes in cui è memorizzato il secret
Questo passaggio è necessario se i dettagli del server proxy sono cambiati o se una registrazione iniziale del cluster ha trascurato i requisiti del proxy.
Dopo aver eseguito questi passaggi, i cluster collegati a GKE elaborano il traffico internet in uscita utilizzando il server proxy specificato nel file di configurazione.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-31 UTC."],[],[],null,["# Proxy support for AKS attached clusters\n\nIf your organization uses an HTTP proxy for internet traffic, you need to\nconfigure GKE attached clusters accordingly. This document describes how to perform\nthis configuration.\n\nBefore you begin\n----------------\n\nGKE attached clusters requires connectivity to various Google Cloud services. Make\nsure your proxy server allows traffic to the following domains:\n\n- `.gcr.io`\n- `cloudresourcemanager.googleapis.com`\n- `container.googleapis.com`\n- `gkeconnect.googleapis.com`\n- `gkehub.googleapis.com`\n- `oauth2.googleapis.com`\n- `securetoken.googleapis.com`\n- `storage.googleapis.com`\n- `sts.googleapis.com`\n- `www.googleapis.com`\n- `servicecontrol.googleapis.com`\n- `logging.googleapis.com`\n- `monitoring.googleapis.com`\n- `opsconfigmonitoring.googleapis.com`\n- \u003cvar translate=\"no\"\u003eGCP_LOCATION\u003c/var\u003e`-gkemulticloud.googleapis.com`\n\nReplace \u003cvar translate=\"no\"\u003eGCP_LOCATION\u003c/var\u003e with the Google Cloud region in\nwhich your cluster resides. Specify `us-west1` or another\n[supported region](/kubernetes-engine/multi-cloud/docs/attached/aks/reference/supported-regions).\n\nConfigure proxy support for GKE attached clusters\n-------------------------------------------------\n\nTo configure proxy support for GKE attached clusters, follow these\nsteps:\n\n1. Create a proxy configuration file which contains values for `httpProxy`,\n `noProxy`, and `httpsProxy` keys:\n\n {\n \"httpProxy\": \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eHTTP_PROXY_AUTHENTICATION_URL\u003c/span\u003e\u003c/var\u003e,\n \"httpsProxy\": \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eHTTPS_PROXY_AUTH_URL\u003c/span\u003e\u003c/var\u003e,\n \"noProxy\": \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eNO_PROXY_ADDRESSES\u003c/span\u003e\u003c/var\u003e\n }\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eHTTP_PROXY_AUTHENTICATION_URL\u003c/var\u003e: the proxy server URL, which consists of a hostname/IP address, and optionally a port, username, and password. For example: `http://user:password@192.0.2.0:80` or just `198.51.100.255`.\n - \u003cvar translate=\"no\"\u003eHTTPS_PROXY_AUTH_URL\u003c/var\u003e: the proxy URL for encrypted HTTPS traffic, which consists of a hostname/IP address, and optionally a port, username, and password.\n - \u003cvar translate=\"no\"\u003eNO_PROXY_ADDRESSES\u003c/var\u003e: a comma-separated list of URLs, CIDR blocks, and DNS names of resources that can bypass the proxy. This directs GKE attached clusters to avoid using the proxy for the specified resources. Keep in mind the following:\n - Values can be individual IP addresses, CIDR ranges, domain names, or even the asterix character (\\*). Using a single asterix (`*`) in the `noProxy` field tells GKE attached clusters to skip the proxy for all traffic.\n - A domain leading with a dot, such as `.google.com`, targets all its subdomains. For example, `.google.com` includes addresses such as `mail.google.com` and `drive.google.com`, but excludes `google.com`.\n - Ensure that you include `kubernetes.default.svc.cluster.local` and `kubernetes.default.svc` domains for proper logging. Here's an example: `198.51.100.0,192.0.2.0/16,examplepetstore.com,.altostrat.com,kubernetes.default.svc.cluster.local, kubernetes.default.svc`.\n\n When creating the proxy configuration file, adhere to the following\n guidelines:\n - The `httpProxy` and `httpsProxy` fields don't accept `https://` prefixes. Use `http://`, even if the real proxy server address begins with `https://`. For example, represent `https://proxy.example.com:3128` as `http://proxy.example.com:3128`.\n - It's compulsory to provide values for all three fields: `httpProxy`, `httpsProxy`, and `noProxy`.\n - Consider appending additional domains, IP addresses, or CIDRs to the `noProxy` list. We recommend that you include the VPC IP range.\n2. Create a Kubernetes Secret, which contains the proxy configuration, by\n running the following command:\n\n kubectl create secret generic \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e \\\n --from-file=\u003cvar translate=\"no\"\u003ePROXY_CONFIGURATION_FILE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e: the name of the Kubernetes Secret\n - \u003cvar translate=\"no\"\u003ePROXY_CONFIGURATION_FILE\u003c/var\u003e: the path to the proxy configuration you created in step 1.\n3. Mark the Kubernetes Secret as\n [immutable](https://kubernetes.io/docs/concepts/configuration/secret/#secret-immutable)\n by setting its `immutable` field to `true`:\n\n kubectl edit secret \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e with the name of the Kubernetes\n Secret.\n4. Configure a new or existing cluster to use the proxy:\n\n ### New cluster\n\n To register a new cluster and apply the proxy configuration, use the\n [`gcloud container attached clusters register` command](/sdk/gcloud/reference/container/attached/clusters/register). Make sure to provide the optional arguments\n `--proxy-secret-name` and `--proxy-secret-namespace`: \n\n gcloud container attached clusters register \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --proxy-secret-name=\u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e \\\n --proxy-secret-namespace=\u003cvar translate=\"no\"\u003eSECRET_NAMESPACE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster\n - \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e: the name of the Kubernetes Secret containing the proxy configuration\n - \u003cvar translate=\"no\"\u003eSECRET_NAMESPACE\u003c/var\u003e: the Kubernetes namespace where the Secret is stored\n\n For information about all the arguments you can use when registering a\n cluster, see the\n [`gcloud container attached clusters register` command](/sdk/gcloud/reference/container/attached/clusters/register).\n\n ### Existing cluster\n\n To update a previously registered cluster with a new proxy configuration,\n use the\n [`gcloud container attached clusters update` command](/sdk/gcloud/reference/container/attached/clusters/update). Make sure to provide the optional arguments `--proxy-secret-name`\n and `--proxy-secret-namespace`: \n\n gcloud container attached clusters update \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --proxy-secret-name=\u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e \\\n --proxy-secret-namespace=\u003cvar translate=\"no\"\u003eSECRET_NAMESPACE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster\n - \u003cvar translate=\"no\"\u003eSECRET_NAME\u003c/var\u003e: the name of the Kubernetes Secret containing the proxy configuration\n - \u003cvar translate=\"no\"\u003eSECRET_NAMESPACE\u003c/var\u003e: the Kubernetes namespace where the Secret is stored\n\n This step is required if your proxy server details have changed, or if an\n initial cluster registration overlooked proxy requirements.\n\n For information about all the arguments you can use when updating a\n cluster, see the\n [`gcloud container attached clusters update` command](/sdk/gcloud/reference/container/attached/clusters/update).\n\nAfter performing these steps, GKE attached clusters processes outbound internet\ntraffic using the proxy server specified in the configuration file."]]