Questo argomento รจ solo a scopo esemplificativo. Spiega come ottenere un certificato TLS dall'autoritร di certificazione (CA) Let's Encrypt.
Questi passaggi vengono forniti principalmente come esempio da seguire se non hai un altro modo pronto per ottenere una coppia di certificati/chiavi autorizzata da un'autoritร di certificazione. L'esempio mostra come generare i certificati utilizzando l'autoritร di certificazione Let's Encrypt, il client Certbot e Cloud DNS della Google Cloud Platform.
Dove puoi utilizzare queste credenziali
Devi fornire le credenziali TLS per due gateway di ingresso Istio esposti al di fuori del cluster:
Gateway
Requisito TLS
Gateway di ingresso MART
Richiede una coppia di chiavi/un certificato TLS autorizzato.
Gateway di ingresso del runtime
Puoi utilizzare una coppia di chiavi/un certificato autofirmato o credenziali TLS autorizzate.
Avrai bisogno di un nome di dominio ottenuto tramite un registrar di nomi di dominio. Puoi registrare un nome di dominio tramite
Google Domains o un altro registrar di domini a tua scelta.
Configura Cloud DNS
Per ottenere le credenziali TLS autorizzate, devi disporre di un nome di dominio qualificato. I passaggi riportati di seguito spiegano come utilizzare Google Cloud DNS per ottenere un nome di dominio e gestire i server di dominio.
Se utilizzi GKE, segui le istruzioni riportate in
Prenotazione di un indirizzo IP esterno statico per creare
due indirizzi IP statici. Puoi assegnare agli indirizzi i nomi che preferisci, ad esempio:
apigee-hybrid-mart e apigee-hybrid-runtime. Al termine, avrai due numeri IP da utilizzare nella configurazione del cluster nel passaggio successivo. Ad esempio:
35.225.131.189 e 34.66.75.196
Se utilizzi Anthos GKE, segui le istruzioni riportate nella
documentazione di Anthos GKE per creare due indirizzi IP statici.
Ottieni l'IP esterno che hai prenotato per apigee-hybrid-mart.
Crea il set di record per l'endpoint MART. Inserisci l'IP esterno ottenuto nel
passaggio precedente e aggiungi un prefisso al nome di dominio, ad esempio mart. Per le istruzioni, consulta
Creare un nuovo record.
Ottieni l'IP esterno che hai prenotato per apigee-hybrid-runtime.
Crea il set di record per l'endpoint di ingresso Istio. Questo รจ l'indirizzo per effettuare chiamate API al gateway ibrido. Inserisci l'IP esterno ottenuto nel
passaggio precedente e aggiungi un prefisso al nome di dominio, ad esempio apitest. Per le istruzioni, consulta
Creare un nuovo record.
Copia i dati del record DNS, come mostrato nell'esempio seguente:
Nella sezione Server dei nomi, fai clic su Modifica.
Inserisci i server dei nomi di dominio che hai copiato dalla pagina Cloud DNS di Network Services:
Ora Google Cloud DNS gestirร i record DNS per il tuo dominio.
Installa Certbot su una VM
Ora che hai configurato Cloud DNS per gestire i tuoi server di dominio, dovrai installare il client Certbot con il plug-in dns_google su una VM Cloud. Il client ti consente di ottenere certificati autorizzati per il tuo dominio da un endpoint Let's Encrypt.
Seleziona IAM e amministrazione > Account di servizio.
La visualizzazione Account di servizio mostra un elenco degli account di servizio del progetto.
Per creare un nuovo account di servizio, fai clic su + Crea account di servizio nella parte superiore della visualizzazione.
Viene visualizzata la visualizzazione Dettagli account di servizio.
Nel campo Nome account di servizio, inserisci il nome dell'account di servizio.
Se vuoi, puoi aggiungere una descrizione nel campo Descrizione account di servizio. Le descrizioni sono utili per ricordare per cosa viene utilizzato un determinato account di servizio.
Fai clic su Crea.
Google Cloud crea un nuovo account di servizio e mostra la visualizzazione Autorizzazioni account di servizio. Utilizza questa visualizzazione per assegnare un ruolo al nuovo account di servizio.
Fai clic sull'elenco a discesa Seleziona un ruolo.
Seleziona il ruolo Proprietario del progetto.
Fai clic su Continua.
Fai clic su Fine.
Nella console di Google Cloud, seleziona Compute Engine > Istanze VM.
Crea un'istanza VM denominata certmanager.
Nella sezione Disco di avvio, scegli CentOS7 e 20 GB per il
disco permanente SSD.
Imposta l'account di servizio su quello che hai creato sopra.
Installa Certbot e il plug-in dns_google sulla macchina ed esegui il client Certbot:
Ora puoi trovare i file del certificato e della chiave privata autorizzati in questa directory:
cd /etc/letsencrypt/live/your_domain_name/
Ad esempio:
cd /etc/letsencrypt/live/apigee-hybrid-docs.netls
cert.pem chain.pem fullchain.pem privkey.pem README
Copia i file fullchain.pem e privkey.pem sul tuo computer locale.
Aggiorna il file delle sostituzioni in modo che punti al certificato e alla chiave privata. Per hostAlias, utilizza il nome DNS che hai creato in precedenza.
[[["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-09-04 UTC."],[[["\u003cp\u003eThis documentation pertains to version 1.1 of Apigee hybrid, which is no longer supported and should be upgraded.\u003c/p\u003e\n"],["\u003cp\u003eThe guide demonstrates obtaining a TLS certificate from Let's Encrypt using Certbot and Google Cloud DNS for example purposes.\u003c/p\u003e\n"],["\u003cp\u003eYou must secure two Istio ingress gateways with TLS credentials, where the MART gateway mandates an authorized certificate/key pair and the runtime gateway can use either self-signed or authorized credentials.\u003c/p\u003e\n"],["\u003cp\u003eSetting up Cloud DNS to manage your domain servers is required for obtaining authorized TLS credentials, involving creating static IPs, managed zones, and record sets.\u003c/p\u003e\n"],["\u003cp\u003eInstall the Certbot client with the dns_google plugin on a Cloud VM, creating a service account and a VM instance for certificate management, followed by certificate acquisition and configuration.\u003c/p\u003e\n"]]],[],null,["# Obtain TLS credentials: An example\n\n| You are currently viewing version 1.1 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\n\nThis topic is intended as an example only. It explains how to obtain a TLS certificate from\nthe certificate authority (CA) [Let's Encrypt](https://letsencrypt.org).\nThese steps are provided primarily as an example to follow if you do not have\nanother ready way to obtain a certificate/key\npair that is authorized by a CA. The example shows how to generate certificates\nusing the [Let's Encrypt](https://letsencrypt.org) CA, the\n[Certbot client](https://certbot.eff.org/about/), and Google Cloud Platform [Cloud DNS](https://cloud.google.com/dns/docs/).\n\nWhere you can use these credentials\n-----------------------------------\n\n\nYou must provide TLS credentials for two Istio ingress gateways that are exposed\noutside the cluster:\n\nSee also [External connections](/apigee/docs/hybrid/v1.1/ports#external).\n\nRequirements\n------------\n\n- You will need a domain name obtained through a domain name registrar. You can register a domain name through Google Domains or another domain registrar of your choice.\n\nConfigure Cloud DNS\n-------------------\n\nTo obtain authorized TLS credentials, you must have a qualified domain name. The following steps explain how to [Google Cloud DNS](https://cloud.google.com/dns/) to obtain a domain name and manage your domain servers.\n\n1. Open the [Google Cloud console](https://console.cloud.google.com) and log in with the account you created in [Step 1: Create a Google Cloud account](/apigee/docs/hybrid/v1.1/precog-gcpaccount).\n2. Select the project that you created in [Step 2: Create a GCP project](/apigee/docs/hybrid/v1.1/precog-gcpproject).\n3. Enable the DNS API. See [Enabling APIs](https://cloud.google.com/apis/docs/getting-started#enabling_apis).\n4. Create two static IP addresses:\n - If you are on GKE, follow the instructions in [Reserving a static external IP address](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address) to create two static IP addresses. You can give the addresses any name you wish, for example: `apigee-hybrid-mart` and `apigee-hybrid-runtime`. When you finish, you will have two IP numbers to use in the cluster configuration in the next step. For example: `35.225.131.189` and `34.66.75.196`\n - If you are on Anthos GKE, follow instructions in the [Anthos GKE documentation](/anthos/clusters/docs/on-prem/1.5/how-to/install-static-ips#configuring_static_ips) to create two static IP addresses.\n5. Create a managed public zone. For instructions, see [Create a managed public zone](https://cloud.google.com/dns/docs/set-up-dns-records-domain-name#create_a_managed_public_zone).\n6. Get the External IP you reserved for the `apigee-hybrid-mart`.\n7. Create record set for the MART endpoint. Enter the External IP you obtained in the previous step and add a prefix to the domain name, such as `mart`. For instructions, see [Create a new record](https://cloud.google.com/dns/docs/set-up-dns-records-domain-name#create_a_new_record).\n\n8. Get the External IP that you reserved for `apigee-hybrid-runtime`.\n9. Create record set for the Istio ingress endpoint. This is the address for making API calls to the hybrid gateway. Enter the External IP you obtained in the previous step and add a prefix to the domain name, such as `apitest`. For instructions, see [Create a new record](https://cloud.google.com/dns/docs/set-up-dns-records-domain-name#create_a_new_record).\n\n10. Copy the DNS record data, as shown in the following example:\n\n11. Return to your domain page at [Google Domains](https://domains.google.com).\n12. Select your domain.\n13. Select **DNS**.\n14. In the Name Servers section, click **Edit**.\n15. Enter the domain name servers that you copied from the Network Services Cloud DNS\n page:\n\n\nNow, your Google Cloud DNS will manage the DNS records for your domain.\n\nInstall Certbot on a VM\n-----------------------\n\n\nNow that you have Cloud DNS set up to manage your domain servers, you will install the\nCertbot client with the\n[dns_google](https://certbot-dns-google.readthedocs.io/en/stable/) plugin on a Cloud VM. The client enables\nyou to get authorized certificates for your domain from a Let's Encrypt endpoint.\n\n1. Open the [Google Cloud console](https://console.cloud.google.com) and log in with the account you created in [Step 1: Create a Google Cloud account](/apigee/docs/hybrid/v1.1/precog-gcpaccount).\n2. Select the project that you created in [Step 2: Create a GCP project](/apigee/docs/hybrid/v1.1/precog-gcpproject).\n3. Select **IAM \\& admin \\\u003e Service accounts** .\n\n The **Service accounts view** displays a list of the project's service accounts.\n4. To create a new service account, click **+Create Service Account** at the top of the view.\n\n The **Service account details** view displays.\n5. In the **Service account name** field, enter the name of the service account.\n\n You can optionally add a description in the **Service account description**\n field. Descriptions are helpful at reminding you what a particular service account is used\n for.\n6. Click **Create** .\n\n GCP creates a new service account and displays the **Service account\n permissions** view. Use this view to assign a role to your new service account.\n7. Click the **Select a role** drop-down list.\n8. Select the **Project Owner** role.\n9. Click **Continue**.\n10. Click **Done**.\n11. In the GCP console, select **Compute Engine \\\u003e VM Instances**.\n12. Create a VM instance named **certmanager**.\n13. Under the Boot Disk section, choose CentOS7 and 20 GB for the SSD persistent drive.\n14. Set the Service Account to the one you created above.\n15. Install Certbot and the [dns_google](https://certbot-dns-google.readthedocs.io/en/stable/) plugin on the machine and run the Certbot client: \n\n sudo su -\n yum -y install yum-utils\n yum install certbot -y\n yum install certbot-dns-google -y\n certbot certonly --dns-google -d *.\u003cvar translate=\"no\"\u003eyour_domain_name\u003c/var\u003e,*.\u003cvar translate=\"no\"\u003eyour_domain_name\u003c/var\u003e --server https://acme-v02.api.letsencrypt.org/directory\n \n\n For example: \n\n sudo su -\n yum -y install yum-utils\n yum install certbot -y\n yum install certbot-dns-google -y\n certbot certonly --dns-google -d *.apigee-hybrid-docs.net,*.apigee-hybrid-docs.net --server https://acme-v02.api.letsencrypt.org/directory\n\n16. You can now find your authorized certificate and private key files in this directory: `cd /etc/letsencrypt/live/`\u003cvar translate=\"no\"\u003eyour_domain_name\u003c/var\u003e`/`\n\n\n For example:\n\n\n cd /etc/letsencrypt/live/apigee-hybrid-docs.net\n ls\n cert.pem chain.pem fullchain.pem privkey.pem README\n\n \u003cbr /\u003e\n\n17. Copy the files `fullchain.pem` and `privkey.pem` to your local machine.\n18. Update your overrides file to point to the certificate and private key. For the `hostAlias`, use the DNS name that you created previously.\n\n\n For example: \n\n ```\n envs:\n - name: test\n sslCertPath: \"$HOME/hybrid/apigee-hybrid-setup/tls/fullchain.pem\"\n sslKeyPath: \"$HOME/hybrid/apigee-hybrid-setup/tls/privkey.pem\"\n hostAlias: \"apitest.apigee-hybrid-docs.net\"\n mart:\n nodeSelector:\n key: cloud.google.com/gke-nodepool\n value: apigee-runtime\n sslCertPath: \"$HOME/hybrid/apigee-hybrid-setup/tls/fullchain.pem\"\n sslKeyPath: \"$HOME/hybrid/apigee-hybrid-setup/tls/privkey.pem\"\n replicaCountMin: 1\n replicaCountMax: 1\n hostAlias: \"mart.apigee-hybrid-docs.net\"\n ```\n19. Apply the changes:\n If you changed the `mart` configuration, apply the changes:\n\n ```\n apigeectl apply -f your_overrides_file -c mart\n ```\n\n\n If you changed the `envs` configuration, apply the changes: \n\n ```\n apigeectl apply -f your_overrides_file -c runtime\n ```\n\nTest the configuration\n----------------------\n\n20. Deploy and test a proxy, as explained in [Create and deploy a new API proxy](/apigee/docs/hybrid/v1.1/test-new-proxy)."]]