Compatibilité du proxy pour les clusters associés à AKS
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Si votre organisation utilise un proxy HTTP pour le trafic Internet, vous devez configurer les clusters associés à GKE en conséquence. Ce document explique comment effectuer cette configuration.
Avant de commencer
Les clusters associés à GKE nécessitent une connectivité à différents services Google Cloud. Assurez-vous que votre serveur proxy autorise le trafic vers les domaines suivants :
.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
Remplacez GCP_LOCATION par la région Google Cloud dans laquelle se trouve votre cluster. Spécifiez us-west1 ou une autre région compatible.
Configurer la compatibilité du proxy pour les clusters associés à GKE
Pour configurer la compatibilité du proxy pour les clusters associés à GKE, procédez comme suit :
Créez un fichier de configuration de proxy contenant les valeurs des clés httpProxy, noProxy et httpsProxy :
HTTP_PROXY_AUTHENTICATION_URL : URL du serveur proxy qui se compose d'un nom d'hôte/d'une adresse IP et éventuellement d'un port, d'un nom d'utilisateur et d'un mot de passe. Par exemple : http://user:password@192.0.2.0:80 ou simplement 198.51.100.255.
HTTPS_PROXY_AUTH_URL : URL du proxy pour le trafic HTTPS chiffré, qui se compose d'un nom d'hôte/d'une adresse IP et éventuellement d'un port, d'un nom d'utilisateur et d'un mot de passe.
NO_PROXY_ADDRESSES : liste des URL, des blocs CIDR et des noms DNS des ressources pouvant contourner le proxy, séparés par une virgule.
Elle indique aux clusters associés à GKE d'éviter d'utiliser le proxy pour les ressources spécifiées. Tenez compte des informations suivantes :
Les valeurs peuvent être des adresses IP individuelles, des plages CIDR, des noms de domaine ou même le caractère astérisque (*). L'utilisation d'un seul astérisque (*) dans le champ noProxy indique aux clusters associés à GKE de contourner le proxy pour tout le trafic.
Un domaine commençant par un point, tel que .google.com, cible l'ensemble de ses sous-domaines. Par exemple, .google.com inclut des adresses telles que mail.google.com et drive.google.com, mais exclut google.com.
Veillez à inclure les domaines kubernetes.default.svc.cluster.local et kubernetes.default.svc pour garantir une journalisation appropriée. Voici un exemple : 198.51.100.0,192.0.2.0/16,examplepetstore.com,.altostrat.com,kubernetes.default.svc.cluster.local, kubernetes.default.svc.
Lorsque vous créez le fichier de configuration du proxy, respectez les consignes suivantes :
Les champs httpProxy et httpsProxy n'acceptent pas les préfixes https://.
Utilisez http://, même si l'adresse du serveur proxy commence par https://.
Par exemple, https://proxy.example.com:3128 doit être représenté par http://proxy.example.com:3128.
Vous devez impérativement indiquer des valeurs pour les trois champs httpProxy, httpsProxy et noProxy.
Envisagez d'ajouter des domaines, des adresses IP ou des plages CIDR supplémentaires à la liste noProxy. Nous vous recommandons d'inclure la plage d'adresses IP du VPC.
Créez un secret Kubernetes contenant la configuration du proxy en exécutant la commande suivante :
PROXY_CONFIGURATION_FILE : chemin d'accès à la configuration du proxy créée à l'étape 1
Marquez le secret Kubernetes comme immuable en définissant son champ immutable sur true :
kubectl edit secret SECRET_NAME
Remplacez SECRET_NAME par le nom du secret Kubernetes.
Configurez un cluster nouveau ou existant pour qu'il utilise le proxy :
Nouveau cluster
Pour enregistrer un nouveau cluster et appliquer la configuration du proxy, exécutez la commande gcloud container attached clusters register. Veillez à fournir les arguments facultatifs --proxy-secret-name et --proxy-secret-namespace :
Pour mettre à jour un cluster précédemment enregistré avec une nouvelle configuration de proxy, exécutez la commande gcloud container attached clusters update. Veillez à fournir les arguments facultatifs --proxy-secret-name et --proxy-secret-namespace :
SECRET_NAME : nom du secret Kubernetes contenant la configuration du proxy
SECRET_NAMESPACE : espace de noms Kubernetes dans lequel le secret est stocké
Cette étape est obligatoire si les informations concernant votre serveur proxy ont changé ou si l'enregistrement initial du cluster ne tenait pas compte des exigences concernant le proxy.
Une fois ces étapes effectuées, les clusters associés à GKE traitent le trafic Internet sortant à l'aide du serveur proxy spécifié dans le fichier de configuration.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/06/28 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2024/06/28 (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."]]