비공개 클러스터는 내부 IP 주소에만 의존하는 Virtual Private Cloud(VPC) 기반 클러스터입니다.
즉, 노드와 포드는 기본적으로 인터넷에서 격리되어 있습니다. 이 페이지에서는 Cloud Code를 사용하여 공개 엔드포인트 액세스 유무에 관계없이 비공개 클러스터에 연결하고 비공개 클러스터가 외부에서 리소스에 액세스하도록 허용하는 방법을 설명합니다. Google Cloud
Cloud Code에 추가한 클러스터의 이름을 마우스 오른쪽 버튼으로 클릭한 다음 클러스터에 Kubectl 프록시 설정을 클릭합니다. 표시되는 메시지에 따라 클러스터의 proxy-url 필드에 저장된 프록시 서버의 이름을 입력합니다. Kubernetes 뷰가 새로고침되어 연결된 클러스터를 표시합니다.
Kubernetes 프록시 취소
Kubernetes 프록시에 대해 구성한 클러스터의 이름을 마우스 오른쪽 버튼으로 클릭한 다음 클러스터에 대한 Kubectl 프록시 취소를 클릭합니다. Cloud Code는 KubeConfig에서 proxy-url 필드를 설정 해제하여 클러스터에 대한 프록시 요청을 중지합니다.
클러스터 외부 리소스에 Google Cloud 액세스
GKE 비공개 클러스터의 모든 구성은 노드에 인터넷 액세스 권한을 제공하지 않습니다. 따라서 클러스터는 공개 인터넷에서 API에 연결할 수 없습니다. 클러스터는 예를 들어 클러스터가 Artifact Registry에서 이미지를 가져올 수 있도록 비공개 Google 액세스로 자동으로 구성됩니다. 노드에서 아웃바운드 인터넷 연결을 허용하는 추가 구성 없이 Google Cloud 외부의 API 및 이미지 레지스트리에 액세스할 수 없습니다.
이러한 연결을 제공하려면 Cloud Code에서 VPC에 Cloud NAT를 설정하면 됩니다.
클러스터를 마우스 오른쪽 버튼으로 클릭하거나 명령어 팔레트(Ctrl \ Cmd+Shift+P를 누르거나 보기 > 명령어 팔레트 클릭)에서 비공개 GKE 노드에 아웃바운드 인터넷 액세스 권한 부여 명령어를 실행합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003ePrivate clusters isolate nodes and pods from the internet by default, relying on internal IP addresses within a Virtual Private Cloud (VPC).\u003c/p\u003e\n"],["\u003cp\u003eCloud Code connects to private clusters by setting the cluster address in the KubeConfig to either the external IP (if the public endpoint is enabled) or the internal VPC IP (if the public endpoint is disabled).\u003c/p\u003e\n"],["\u003cp\u003eTo connect to a private cluster, Cloud Code must be on a machine within the cluster's network or have network access, such as through a proxy server, Cloud Interconnect, or Cloud VPN.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code can configure a proxy server to route requests to a private cluster's control plane when the control plane API is not publicly available.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code allows the configuration of Cloud NAT to enable outbound internet connections from private clusters to access APIs and image registries outside of Google Cloud.\u003c/p\u003e\n"]]],[],null,["# Configure a private cluster in Cloud Code for VS Code\n\nA *private cluster* is a Virtual Private Cloud (VPC)-native cluster that only\ndepends on [internal IP addresses](/kubernetes-engine/docs/concepts/alias-ips#internal_ip_addresses).\nThis means that nodes and pods are isolated from the internet by default. This\npage explains how to use Cloud Code to connect to private\nclusters with and without public endpoint access and permit private clusters to\naccess resources from outside Google Cloud.\n\nFor information about private clusters, see\n[Private clusters](/kubernetes-engine/docs/concepts/private-cluster-concept).\nFor steps to configure private clusters, see\n[Creating a private cluster](/kubernetes-engine/docs/how-to/private-clusters).\n\nAdd a private GKE cluster to your KubeConfig\n--------------------------------------------\n\nAdding a private cluster in Cloud Code has the following behavior:\n\n- For clusters that have the public endpoint enabled, adding the cluster sets\n the cluster address in the KubeConfig to the external IP.\n\n- For clusters that have the public endpoint turned off, adding the cluster sets\n the cluster address in the KubeConfig to be the internal VPC IP of the\n cluster.\n\nTo add an authorized network to an existing cluster, make sure you are connected\nto an authorized network, as this cluster has [authorized networks enabled](/kubernetes-engine/docs/how-to/authorized-networks#add).\n\nTo learn more about connecting to VMs without external IP addresses, see\n[Securely connecting to VM instances](/solutions/connecting-securely#external).\nTo manage/delete the instances that you created, see\n[VM instances](https://console.cloud.google.com/compute/instances).\n\nTo successfully connect to the private cluster, Cloud Code must be\nrunning on a machine in the cluster's network or be able to access the cluster's\nnetwork, such as by using a proxy server, Cloud Interconnect, or\nCloud VPN.\n\nFor steps to create GKE clusters in Cloud Code\nand add existing GKE clusters to Cloud Code, see\n[create and configure a GKE cluster](/code/docs/vscode/create-configure-gke-cluster).\nCloud Code opens the Google Cloud console to create your cluster.\n\nAfter you create the cluster, [configure Cloud NAT](/nat/docs/gke-example?_ga=2.200274222.-1614030937.1640827593#gcloud)\nto enable outbound internet connections from your cluster if this was not set up\nduring cluster creation. To manage/delete the networks that you created, see\n[VPC networks](https://console.cloud.google.com/networking/networks/list).\n\nTroubleshoot issues connecting to private clusters\n--------------------------------------------------\n\nIf your dev environment isn't configured correctly to access a private cluster,\nrecommendations about how to resolve the issue appear in the following contexts:\n\n- In the expanded **Kubernetes** section, clusters that\n Cloud Code can't connect to appear with an error icon next to\n the cluster name. To view possible workarounds and a longer explanation of the\n potential issue, click the cluster name.\n\n- When you try to run operations on a cluster that's inaccessible because of\n potential issues with the private cluster's configuration, a notification\n displays an error message with a longer explanation of the potential issue and\n potential workarounds.\n\nConfigure a proxy server for a cluster\n--------------------------------------\n\nIf the\n[control plane API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/)\nisn't available publicly, such as in a GKE cluster with public\nendpoint turned off, you can configure Cloud Code to proxy\nrequests to the control plane through a proxy server on the same network or VPC\nas the cluster:\n\n1. Configure a proxy server on the same network as your cluster if you haven't already. For steps to set up a Compute Engine VM as a basic proxy server, see [Remotely access a private cluster using a bastion host](/kubernetes-engine/docs/tutorials/private-cluster-bastion). For additional details, see [Creating Google Kubernetes Engine private clusters with network proxies for controller access](/architecture/creating-kubernetes-engine-private-clusters-with-net-proxies).\n2. Right-click the name of a cluster you've [added to Cloud Code](#private) and then click **Set up Kubectl Proxying for cluster** . Follow the prompts to enter the name of your proxy server, which is stored in the cluster's `proxy-url` field. The Kubernetes view reloads to display the connected cluster.\n\n### Cancel Kubernetes proxying\n\nRight-click the name of a cluster you've configured for Kubernetes proxying and\nthen click **Cancel Kubectl Proxying for cluster** . Cloud Code\nstops proxying requests for the cluster by unsetting the `proxy-url` field\nin the KubeConfig.\n\nAccess resources outside Google Cloud from clusters\n---------------------------------------------------\n\nAll configurations of GKE private clusters don't provide nodes\nwith internet access. As a result, clusters can't reach APIs on the public\ninternet. Clusters are automatically configured with\n[Private Google Access](/vpc/docs/private-google-access),\nwhich, for example, permits clusters to pull images from Artifact Registry. APIs and\nimage registries outside of Google Cloud are inaccessible without\nadditional configuration to allow outbound internet connections from the nodes.\nTo provide these connections, you can set up\n[Cloud NAT](/nat/docs/overview#NATwithGKE) on your VPC from\nCloud Code:\n\n1. Run the **Grant private GKE nodes outbound internet access** command, either by right-clicking a cluster or from the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette**).\n2. In the terminal, edit the [`gcloud compute routers create`](/sdk/gcloud/reference/compute/routers/create) and [`gcloud beta compute routers nats create`](/sdk/gcloud/reference/beta/compute/routers/nats/create) commands to specify the values for your application.\n3. To run the commands, press `Enter`.\n4. To manage/delete the routers that you created, see [Cloud Routers](https://console.cloud.google.com/hybrid/routers/list).\n\nWhat's next\n-----------\n\n- Learn about [Shared Virtual Private Cloud networks](/vpc/docs/shared-vpc).\n\nGet Support\n-----------\n\nTo send feedback, report issues on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues), or ask a question on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cloud-code-vscode)."]]