Accesso ai cluster VPC tramite il gateway Virtual Private Endpoint
Per ogni cluster VPC viene creato automaticamente un gateway VPE(Virtual Private Endpoint). È possibile accedere al master del cluster tramite questo endpoint se gli utenti autorizzati sono connessi alla stessa rete VPC, ad esempio tramite una VPN VPC.
Per i cluster che utilizzano la versione 4.13: se durante la creazione del cluster è stato abilitato solo l'endpoint del servizio cloud privato, per impostazione predefinita viene utilizzato il VPE della VPC per accedere ai componenti di Red Hat OpenShift, quali la console web o OperatorHub. Per accedere a questi componenti è necessario essere connessi alla rete VPC privata.
Prima di iniziare
- Installare gli strumenti CLI necessari.
- Configura una VPN client-to-site o site-to-site verso la tua VPC e stabilisci la connessione.
Accesso a un cluster VPC tramite il gateway VPE
-
Imposta il contesto del cluster utilizzando l'endpoint VPE.
ibmcloud oc cluster config -c CLUSTER_NAME_OR_ID --endpoint vpe -
Accedi al cluster utilizzando uno dei seguenti metodi.
- In qualità di amministratore:
ibmcloud oc cluster config -c CLUSTER_NAME_OR_ID --admin --endpoint vpe - Con una chiave API: consulta la sezione " Accesso ai cluster da strumenti di automazione ".
- Con un codice di accesso:
oc login -u passcode -p <iam_passcode> --server=https://<VPE_URL>:<port>
- In qualità di amministratore:
-
Verifica l'accesso.
oc version
Creazione di gateway VPE aggiuntivi in altre VPC e account
Oltre al gateway VPE creato per un cluster all'interno della propria VPC, è possibile creare ulteriori gateway VPE per quel cluster, al fine di consentire l'accesso tramite la rete privata da altre VPC, regioni e account.
-
È necessario creare ulteriori gateway VPE tramite la CLI o l'API. Una volta creati, possono essere gestiti nell'interfaccia utente web.
-
Per i gateway VPE tra account diversi, è necessario innanzitutto creare un'autorizzazione nell'account di destinazione. Per ulteriori informazioni, consultare la sezione " Creazione dell'autorizzazione al servizio per VPE tra account" nella console.
-
Non è necessario alcun gateway di transito né alcun instradamento speciale. Il gateway VPE gestisce l'instradamento verso il cluster di destinazione.
I passaggi seguenti illustrano come creare un gateway VPE tra account.
-
Recupera le informazioni necessarie dal cluster di destinazione.
-
Impostare "
ibmcloud target" sull'account, sulla regione e sul gruppo di risorse di destinazione. -
Recupera le informazioni relative al gateway VPE esistente.
ibmcloud is endpoint-gateway iks-TARGET_CLUSTER_ID ``` 1. Prendere nota del **CRN di destinazione** (formato: `crn:v1:bluemix:public:containers-kubernetes:REGION:a/TARGET_ACCOUNT:TARGET_CLUSTER_ID::`). 1. Prendere nota dei nomi host **degli endpoint di servizio**. -
-
Crea il nuovo gateway VPE nell'account di origine.
-
Impostare "
ibmcloud target" sull'account di origine, sulla regione e sul gruppo di risorse. -
Verifica che il VPC esista in questo account.
ibmcloud is vpcs ``` 1. Creare il gateway VPE. ```sh {: pre} ibmcloud is endpoint-gateway-create --vpc SOURCE_VPC_NAME --target TARGET_CRN --name new-iks-TARGET_CLUSTER_ID --resource-group-name SOURCE_ACCOUNT_RESOURCE_GROUP ``` `SOURCE_VPC_NAME` : Il nome del VPC indicato nel passaggio precedente. `TARGET_CRN` : Il CRN proveniente dal gateway VPE del cluster di destinazione. `--name` : Un nome per il tuo gateway VPE. `SOURCE_ACCOUNT_RESOURCE_GROUP` : Il nome del gruppo di risorse nell'account di origine. 1. Se viene visualizzato l'errore " `Could not find service`", verificare che il CRN di destinazione sia corretto. Se è corretto, devi creare l'autorizzazione nell'account di destinazione. Vedere la sezione " [Creazione dell'autorizzazione al servizio per VPE tra account" nella console](/docs/vpc?topic=vpc-ordering-cross-account-endpoint-gateway&interface=ui#cross-account-vpe-prerequisite-console). -
-
Aggiungi gli indirizzi IP riservati al tuo gateway VPE.
È necessario aggiungere almeno un indirizzo IP riservato. Gli indirizzi IP riservati provengono dalle sottoreti della VPC di origine (al massimo uno per zona) e vengono aggiunti alle voci DNS private della VPC di origine.
- Crea un indirizzo IP riservato per ogni zona.
ibmcloud is subnet-reserved-ip-create SOURCE_VPC_SUBNET_NAME --vpc SOURCE_VPC_NAME --name ANY_NAME_YOU_CHOOSE --auto-delete true --target VPE_GATEWAY_NAME ``` 1. Facoltativo: aggiungere o modificare i gruppi di sicurezza. Per impostazione predefinita, viene associato solo il gruppo di sicurezza predefinito della VPC di origine. Per i gateway VPE, i gruppi di sicurezza proteggono solo il traffico in entrata. Assicurarsi che i gruppi di sicurezza consentano tutto il traffico in entrata necessario proveniente dai client. -
Verifica la connessione.
-
Da un VSI nel VPC di origine, utilizzare lo stesso nome host del gateway VPE originale. È possibile trovarlo nell'elenco " Service Endpoints " o nella proprietà " VPE Gateway " all'indirizzo
ibmcloud ks cluster get -c CLUSTER_NAME. -
Verifica che la connessione funzioni.
curl -k https://CLUSTERID...:XXXXX/version ``` 1. Se la connessione non va a buon fine, verificare quanto segue: * I gruppi di sicurezza sui gateway VSI e VPE consentono il traffico necessario * L'ACL VPC consente il traffico * Le regole di restrizione basata sul contesto (CBR) sul cluster di destinazione consentono il traffico privato proveniente dalla VPC di origine (aggiungi i tre indirizzi `Cloud Service Endpoint source addresses` della tua VPC di origine alla regola CBR privata) -
Esempio di conto target
L'esempio seguente mostra i comandi eseguiti nell'account di destinazione per raccogliere informazioni sul cluster e sul relativo gateway VPE.
-
Verifica di aver selezionato l'account corretto.
ibmcloud targetOutput di esempio
API endpoint: https://cloud.ibm.com Region: us-east User: user2@example.com Account: Target Account (9f8e7d6c5b4a321fedcba98765432222) <-> 2222222 Resource group: default -
Elenca i tuoi cluster.
ibmcloud ks clustersOutput di esempio
OK Name ID State Created Workers Location Version Resource Group Name Provider vpe-cross-account-test c8m5n3p2q4x6z1w7y077 normal 1 day ago 2 Washington DC 4.19.25_1572_openshift default vpc-gen2 -
Ottieni i dettagli del gateway VPE. Prendere nota del CRN di destinazione e degli endpoint di servizio.
ibmcloud is endpoint-gateway iks-c8m5n3p2q4x6z1w7y077Output di esempio
Getting endpoint gateway iks-c8m5n3p2q4x6z1w7y077 under account Target Account as user user2@example.com... ID r014-7a228b24-4bc4-416c-aede-7fda14e88d98 Name iks-c8m5n3p2q4x6z1w7y077 CRN crn:v1:bluemix:public:is:us-east:a/9f8e7d6c5b4a321fedcba98765432222::endpoint-gateway:r014-7a228b24-4bc4-416c-aede-7fda14e88d98 Target CRN crn:v1:bluemix:public:containers-kubernetes:us-east:a/9f8e7d6c5b4a321fedcba98765432222:c8m5n3p2q4x6z1w7y077:: DNS resolution binding mode primary Target Type provider_cloud_service Target Remote ID Name Resource type No target remote found. VPC ID Name r014-464b4e54-48a8-4f6c-b10a-68edc6fd2be4 new-vpcgen2-default-sec-grp-wdc Private IPs ID Name Address Subnet ID 0757-3bd457cb-af5a-4ab6-b9bb-6e78d3eaf752 iks-useast1-c8m5n3p2q4x6z1w7y077-2e8 172.22.0.11 0757-0c981aa5-cb47-41d9-ab29-edee98b416f8 Service Endpoints c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com Lifecycle State stable Health State ok Security groups ID Name r014-3873358e-3180-482b-927e-abcc300ecbf8 kube-vpegw-c8m5n3p2q4x6z1w7y077 Created 2026-04-03T12:14:59-05:00 Resource Group default -
Facoltativo: recuperare i dettagli del cluster per visualizzare il gateway VPE URL.
ibmcloud ks cluster get -c c8m5n3p2q4x6z1w7y077Output di esempio
Retrieving cluster c8m5n3p2q4x6z1w7y077... OK Name: vpe-cross-account-test ID: c8m5n3p2q4x6z1w7y077 State: normal Status: All Workers Normal Created: 2026-04-03 11:56:38 -0500 (1 day ago) Resource Group ID: 950cec30388441ce809ca0d18b5ca3bc Resource Group Name: default Pod Subnet: 172.17.0.0/18 Service Subnet: 172.21.0.0/16 Workers: 2 Worker Zones: us-east-1 Ingress Subdomain: vpe-cross-account-test-354226545946e7ee0a2c700f061c1661-0000.us-east.containers.appdomain.cloud Ingress Secret: vpe-cross-account-test-354226545946e7ee0a2c700f061c1661-0000 Ingress Status: healthy Ingress Message: All Ingress components are healthy. Trusted Profile ID: - Public Service Endpoint URL: https://c111-e.us-east.containers.cloud.ibm.com:31100 Private Service Endpoint URL: https://c111.private.us-east.containers.cloud.ibm.com:31100 Pull Secrets: enabled in the default namespace VPCs: r014-464b4e54-48a8-4f6c-b10a-68edc6fd2be4 VPE Gateway: https://c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com:31100 OAuth Server URL: https://c111-e.us-east.containers.cloud.ibm.com:31264 Konnectivity Server URL: https://c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com:30996 Secure By Default Networking: enabled Outbound Traffic Protection: enabled Master Status: Ready (1 day ago) State: deployed Health: normal Version: 4.19.25_1572_openshift Location: Washington DC URL: https://c111-e.us-east.containers.cloud.ibm.com:31100
Esempio di conto di origine
L'esempio seguente mostra i comandi eseguiti nell'account di origine per creare un gateway VPE che si connette al cluster nell'account di destinazione.
-
Verifica di aver selezionato l'account di origine corretto.
ibmcloud targetOutput di esempio
API endpoint: https://cloud.ibm.com Region: us-south User: user1@example.com Account: Source Account (a1b2c3d4e5f6789abcdef01234561111) <-> 1111111 Resource group: Default -
Elenca i tuoi VPC.
ibmcloud is vpcsOutput di esempio
Listing vpcs in resource group Default and region us-south under account Source Account as user user1@example.com... ID Name Status Classic access Default network ACL Default security group Resource group Health state DNS Hub DNS Resolver Type r006-6f450c4b-c808-40e7-9de6-c61c262a2ae9 dev-ansiblepr-vpc available false vendor-paradox-ravioli-tank harmonica-hypnoses-tranquil-alkalize Default ok false system r006-bd06a98a-1183-42d2-810d-1c564eeb5f39 fvt-vpc-sdnlb-server-40 available false sloppy-program-venue-subsiding prattle-pension-wilt-recycled Default ok false system r006-ecf65055-6868-4368-aa7c-48fc5ac29ff8 network-fvt-us-south available false doorknob-baffle-quintet-poem spotted-sandpaper-auction-unluckily Default ok false system r006-4ff93772-cee9-4d64-9d87-d8b1b781e201 network-fvt-vpc-gen2 available false stegosaur-reach-boxlike-alone-stranger-uncork earplugs-preface-county-juicy-sensitize-babied Default ok false system -
Crea il gateway VPE utilizzando il CRN di destinazione dell'account di destinazione.
ibmcloud is endpoint-gateway-create --vpc network-fvt-us-south --target crn:v1:bluemix:public:containers-kubernetes:us-east:a/9f8e7d6c5b4a321fedcba98765432222:c8m5n3p2q4x6z1w7y077:: --name new-iks-c8m5n3p2q4x6z1w7y077 --resource-group-name DefaultOutput di esempio
Creating endpoint gateway new-iks-c8m5n3p2q4x6z1w7y077 in resource group Default under account Source Account as user user1@example.com... ID r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Name new-iks-c8m5n3p2q4x6z1w7y077 CRN crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Target CRN crn:v1:bluemix:public:containers-kubernetes:us-east:a/9f8e7d6c5b4a321fedcba98765432222:c8m5n3p2q4x6z1w7y077:: DNS resolution binding mode primary Target Type provider_cloud_service Target Remote ID Name Resource type No target remote found. VPC ID Name r006-ecf65055-6868-4368-aa7c-48fc5ac29ff8 network-fvt-us-south Private IPs - Service Endpoints c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com Lifecycle State pending Health State ok Security groups ID Name r006-7ae081e2-743d-4046-b755-5ca9997ae077 spotted-sandpaper-auction-unluckily Created 2026-04-04T18:17:12-05:00 Resource Group Default -
Elenca le sottoreti per individuare quelle da utilizzare per gli indirizzi IP riservati.
ibmcloud is subnets --vpc network-fvt-us-southOutput di esempio
Listing subnets in resource group Default and region us-south under account Source Account as user user1@example.com... ID Name Status Subnet CIDR Addresses ACL Public Gateway VPC Zone Resource group 0717-04288f84-4aef-4938-9fa7-5544a40ba258 network-fvt-us-south-1-priv available 10.240.0.0/24 251/256 doorknob-baffle-quintet-poem - network-fvt-us-south us-south-1 Default 0717-cdd4b20c-b48f-454b-b092-ad7aa14b39c8 network-fvt-us-south-1-pubgw available 10.240.1.0/24 246/256 doorknob-baffle-quintet-poem pgw-33eb53d0-74e4-11ee-a747-33927b3ab784 network-fvt-us-south us-south-1 Default 0727-8813de08-fffa-45e3-ae67-2ba70703866e network-fvt-us-south-2-priv available 10.240.64.0/24 250/256 doorknob-baffle-quintet-poem - network-fvt-us-south us-south-2 Default 0727-50b14707-c9f6-4f93-9f49-99de13c66161 network-fvt-us-south-2-pubgw available 10.240.65.0/24 251/256 doorknob-baffle-quintet-poem pgw-34fe4a70-74e4-11ee-a747-33927b3ab784 network-fvt-us-south us-south-2 Default 0737-7a644374-f121-44c1-b216-5fd94c0362b2 network-fvt-us-south-3-priv available 10.240.128.0/24 251/256 doorknob-baffle-quintet-poem - network-fvt-us-south us-south-3 Default 0737-71a34942-304c-4419-9205-3714a3574962 network-fvt-us-south-3-pubgw available 10.240.129.0/24 251/256 doorknob-baffle-quintet-poem pgw-36088e80-74e4-11ee-a747-33927b3ab784 network-fvt-us-south us-south-3 Default -
Creare un indirizzo IP riservato nella prima zona e associarlo al gateway VPE.
ibmcloud is subnet-reserved-ip-create network-fvt-us-south-1-pubgw --vpc network-fvt-us-south --name reserved-ip-for-us-south-1 --auto-delete true --target new-iks-c8m5n3p2q4x6z1w7y077Output di esempio
Creating reserved IP in subnet network-fvt-us-south-1-pubgw under account Source Account as user user1@example.com... ID 0717-685e1410-2fa1-4e7a-a4e5-27a097ec7a7a Name reserved-ip-for-us-south-1 Address 0.0.0.0 Auto delete true Owner user Created 2026-04-04T18:18:51-05:00 Lifecycle state pending Target ID Name Resource type CRN r006-2009f147-768a-4f6a-b8fa-75f20456cec2 new-iks-c8m5n3p2q4x6z1w7y077 endpoint_gateway crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 -
Verifica che l'indirizzo IP riservato sia stato aggiunto.
ibmcloud is eg new-iks-c8m5n3p2q4x6z1w7y077Output di esempio
Getting endpoint gateway new-iks-c8m5n3p2q4x6z1w7y077 under account Source Account as user user1@example.com... ID r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Name new-iks-c8m5n3p2q4x6z1w7y077 CRN crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Target CRN crn:v1:bluemix:public:containers-kubernetes:us-east:a/9f8e7d6c5b4a321fedcba98765432222:c8m5n3p2q4x6z1w7y077:: DNS resolution binding mode primary Target Type provider_cloud_service Target Remote ID Name Resource type No target remote found. VPC ID Name r006-ecf65055-6868-4368-aa7c-48fc5ac29ff8 network-fvt-us-south Private IPs ID Name Address Subnet ID 0717-685e1410-2fa1-4e7a-a4e5-27a097ec7a7a reserved-ip-for-us-south-1 10.240.1.5 0717-cdd4b20c-b48f-454b-b092-ad7aa14b39c8 Service Endpoints c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com Lifecycle State stable Health State ok Security groups ID Name r006-7ae081e2-743d-4046-b755-5ca9997ae077 spotted-sandpaper-auction-unluckily Created 2026-04-04T18:17:12-05:00 Resource Group Default -
Creare un indirizzo IP riservato nella seconda zona e associarlo al gateway VPE.
ibmcloud is subnet-reserved-ip-create network-fvt-us-south-2-pubgw --vpc network-fvt-us-south --name reserved-ip-for-us-south-2 --auto-delete true --target new-iks-c8m5n3p2q4x6z1w7y077Output di esempio
Creating reserved IP in subnet network-fvt-us-south-2-pubgw under account Source Account as user user1@example.com... ID 0727-d315d943-c501-4f69-823d-bb82a2b13b29 Name reserved-ip-for-us-south-2 Address 0.0.0.0 Auto delete true Owner user Created 2026-04-04T18:19:24-05:00 Lifecycle state pending Target ID Name Resource type CRN r006-2009f147-768a-4f6a-b8fa-75f20456cec2 new-iks-c8m5n3p2q4x6z1w7y077 endpoint_gateway crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 -
Crea un indirizzo IP riservato nella terza zona e associarlo al gateway VPE.
ibmcloud is subnet-reserved-ip-create network-fvt-us-south-3-pubgw --vpc network-fvt-us-south --name reserved-ip-for-us-south-3 --auto-delete true --target new-iks-c8m5n3p2q4x6z1w7y077Output di esempio
Creating reserved IP in subnet network-fvt-us-south-3-pubgw under account Source Account as user user1@example.com... ID 0737-afbebd9f-02bd-4b9a-be90-5bacf9836041 Name reserved-ip-for-us-south-3 Address 0.0.0.0 Auto delete true Owner user Created 2026-04-04T18:19:32-05:00 Lifecycle state pending Target ID Name Resource type CRN r006-2009f147-768a-4f6a-b8fa-75f20456cec2 new-iks-c8m5n3p2q4x6z1w7y077 endpoint_gateway crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 -
Verificare che tutti gli indirizzi IP riservati siano stati aggiunti.
ibmcloud is eg new-iks-c8m5n3p2q4x6z1w7y077Output di esempio
Getting endpoint gateway new-iks-c8m5n3p2q4x6z1w7y077 under account Source Account as user user1@example.com... ID r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Name new-iks-c8m5n3p2q4x6z1w7y077 CRN crn:v1:bluemix:public:is:us-south:a/a1b2c3d4e5f6789abcdef01234561111::endpoint-gateway:r006-2009f147-768a-4f6a-b8fa-75f20456cec2 Target CRN crn:v1:bluemix:public:containers-kubernetes:us-east:a/9f8e7d6c5b4a321fedcba98765432222:c8m5n3p2q4x6z1w7y077:: DNS resolution binding mode primary Target Type provider_cloud_service Target Remote ID Name Resource type No target remote found. VPC ID Name r006-ecf65055-6868-4368-aa7c-48fc5ac29ff8 network-fvt-us-south Private IPs ID Name Address Subnet ID 0737-afbebd9f-02bd-4b9a-be90-5bacf9836041 reserved-ip-for-us-south-3 10.240.129.5 0737-71a34942-304c-4419-9205-3714a3574962 0717-685e1410-2fa1-4e7a-a4e5-27a097ec7a7a reserved-ip-for-us-south-1 10.240.1.5 0717-cdd4b20c-b48f-454b-b092-ad7aa14b39c8 0727-d315d943-c501-4f69-823d-bb82a2b13b29 reserved-ip-for-us-south-2 10.240.65.5 0727-50b14707-c9f6-4f93-9f49-99de13c66161 Service Endpoints c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com Lifecycle State stable Health State ok Security groups ID Name r006-7ae081e2-743d-4046-b755-5ca9997ae077 spotted-sandpaper-auction-unluckily Created 2026-04-04T18:17:12-05:00 Resource Group Default -
Verifica la connessione da un VSI nella VPC di origine.
curl -k https://c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.com:31100/versionOutput di esempio
{ "major": "1", "minor": "32", "gitVersion": "v1.32.12", "gitCommit": "9b706b45b52a0c8bb05847295ee98ffccbabba32", "gitTreeState": "clean", "buildDate": "2026-02-19T13:30:47Z", "goVersion": "go1.23.10 (Red Hat 1.23.10-10.el9) X:strictfipsruntime", "compiler": "gc", "platform": "linux/amd64" } -
Verificare che il nome host corrisponda a un indirizzo IP riservato.
dig +short c8m5n3p2q4x6z1w7y077.vpe.private.us-east.containers.cloud.ibm.comOutput di esempio
10.240.65.5