Cloud Service Mesh용 Gateway API 설정 준비
이 페이지에서는 클러스터에 게이트웨이에 필요한 커스텀 리소스 정의를 설치하는 방법을 설명합니다.
제한사항
- 동일한 Fleet에서
gatewayconfig-api 클러스터와istioconfig-api 클러스터를 혼합하는 것은 지원되지 않습니다. gatewayconfig-api 클러스터에는 멀티 클러스터 서비스 검색 및 부하 분산이 지원되지 않습니다.- 기존
--management automatic플래그를 사용하여 클러스터를 온보딩하면 클러스터는istio구성 API를 사용하기 시작하며gatewayAPI로 변경할 수 없습니다. - FQDN만 지원됩니다. 닉네임은 지원되지 않습니다.
기본 요건
먼저 이 가이드에서는 이미 Google Cloud 프로젝트를 만들고 kubectl를 설치했다고 가정합니다.
시작하기 전에
- 계정에 로그인합니다. Google Cloud 를 처음 사용하는 경우 Google Cloud, 계정을 만들어 실제 시나리오에서 제품이 어떻게 작동하는지 평가하세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Kubernetes Engine, GKE Hub, and Cloud Service Mesh APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Kubernetes Engine, GKE Hub, and Cloud Service Mesh APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
- 클러스터의 kubeconfig 항목을 생성합니다.
gcloud container clusters get-credentials CLUSTER_NAME --location LOCATION --project PROJECT_ID
각 항목의 의미는 다음과 같습니다.
- CLUSTER_NAME은 클러스터 이름입니다.
- LOCATION은 클러스터 위치입니다.
- PROJECT_ID는 클러스터의 프로젝트 ID입니다.
GKE 클러스터 만들기 및 등록
GKE 클러스터를 만듭니다.
gcloud container clusters create CLUSTER_NAME \ --location=LOCATION \ --enable-ip-alias \ --scopes=https://www.googleapis.com/auth/cloud-platform \ --release-channel=regular \ --project=PROJECT_ID \ --gateway-api=standard각 항목의 의미는 다음과 같습니다.
- CLUSTER_NAME은 클러스터 이름입니다.
- LOCATION은 클러스터 위치입니다.
- PROJECT_ID는 클러스터의 프로젝트 ID입니다.
GKE용 워크로드 아이덴티티 제휴 사용 설정
gcloud container clusters update CLUSTER_NAME \ --location LOCATION \ --workload-pool=PROJECT_ID.svc.id.goog노드에서 GKE 메타데이터 서버를 실행합니다.
gcloud container node-pools update default-pool \ --cluster=CLUSTER_NAME \ --location=LOCATION \ --workload-metadata=GKE_METADATAFleet에 클러스터를 등록합니다.
gcloud container hub memberships register CLUSTER_NAME \ --gke-cluster LOCATION/CLUSTER_NAME \ --project=PROJECT_ID클러스터가 Fleet에 등록되었는지 확인합니다.
gcloud container hub memberships list --project=PROJECT_ID출력은 다음과 비슷합니다.
NAME EXTERNAL_ID LOCATION my-cluster 91980bb9-593c-4b36-9170-96445c9edd39 us-west1
권한 설정
다음 명령어는 모든 인증된 사용자에게 권한을 부여하지만 GKE용 워크로드 아이덴티티 제휴를 사용하여 일부 계정에만 권한을 부여할 수 있습니다.
trafficdirector.client역할을 부여합니다.gcloud projects add-iam-policy-binding PROJECT_ID \ --member "group:PROJECT_ID.svc.id.goog:/allAuthenticatedUsers/" \ --role "roles/trafficdirector.client"container.developer역할을 부여합니다.gcloud projects add-iam-policy-binding PROJECT_ID \ --member "serviceAccount:service-PROJECT_NUMBER@container-engine-robot.iam.gserviceaccount.com" \ --role "roles/container.developer"여기서 PROJECT_NUMBER는 프로젝트 번호입니다.
compute.networkAdmin역할을 부여합니다.gcloud projects add-iam-policy-binding PROJECT_ID \ --member "serviceAccount:service-PROJECT_NUMBER@container-engine-robot.iam.gserviceaccount.com" \ --role "roles/compute.networkAdmin"여기서 PROJECT_NUMBER는 프로젝트 번호입니다.
Cloud Service Mesh 사용 설정
메시 기능을 사용 설정합니다.
gcloud container hub mesh enable --project PROJECT_IDGateway API를 사용하도록 메시를 업데이트합니다.
gcloud alpha container fleet mesh update \ --config-api gateway \ --memberships CLUSTER_NAME \ --project PROJECT_IDCloud Service Mesh 리소스의 상태를 설명하여 업데이트를 확인합니다.
gcloud alpha container fleet mesh describe
커스텀 리소스 정의 설치
GRPCRoute 커스텀 리소스 정의(CRD)를 설치합니다.
curl https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.1.0/config/crd/standard/gateway.networking.k8s.io_grpcroutes.yaml \
| kubectl apply -f -
출력은 다음과 비슷합니다.
customresourcedefinition.apiextensions.k8s.io/grpcroutes.gateway.networking.k8s.io created