Knative serving Fleet 구성요소 설치

Knative serving을 GKE Enterprise Fleet 구성요소로 설치합니다.

시작하기 전에

개요

Knative serving을 Fleet 구성요소로 설치하는 방법은 다음과 같습니다.

  1. Google Cloud 프로젝트에서 Fleet을 사용 설정합니다.
  2. gke-system-gateway 게이트웨이를 knative-ingress-gateway 게이트웨이에 복사합니다.
  3. 클러스터에 Knative serving 커스텀 리소스를 설치합니다.

이 프로세스 중에 기존 Knative serving 서비스는 끊김 없이 서비스 트래픽을 계속 처리합니다.

Knative serving Fleet 구성요소 설치

이 섹션에서는 Knative serving을 Fleet 구성요소로 설치하기 위해 마이그레이션 스크립트를 사용합니다.

  1. 다음 명령어를 실행하여 마이그레이션 스크립트를 시작합니다.

    ./migration-addon.sh --command install-cloud-run-v2
    

    이 단계에 문제가 있거나 항목을 변경하려면 이 마이그레이션 스크립트 명령어를 다시 실행하면 됩니다.

  2. 터미널에서 마이그레이션 스크립트는 각 작업 수행을 확인하라는 메시지를 표시합니다. 각 프롬프트에서 y를 입력하여 작업을 계속합니다.

    Knative serving Fleet 구성요소를 설치하는 프로세스 중의 프롬프트는 다음과 유사합니다.

    In the process of installing the Knative serving fleet component, the
    script performs the following:
    1. Enabling the fleet in your Google Cloud project.
    2. Copy gke-system-gateway Gateway to knative-ingress-gateway Gateway
    3. Installing the Knative serving custom resource in your cluster.
    Continue? [Y/n] y
    
    1. Enabling Anthos services?
    Continue? [Y/n] y
    
    Operation "operations/acf.p2-625914735451-10d4b6ff-68e1-4a09-97c4-79b209be5031" finished successfully.
    
    2. Copying gke-system-gateway Gateway to knative-ingress-gateway Gateway
    
    configmap/original-knative-ingress-gateway-spec unchanged
    gateway.networking.istio.io/knative-ingress-gateway patched (no
    change)
    configmap/config-istio patched
    configmap/config-istio patched
    gateway.networking.istio.io "gke-system-gateway" deleted
    
    3. Install the Knative serving custom resource in your cluster?
    Continue? [Y/n] y
    
    Waiting for Knative serving feature to be enabled
    Knative serving feature is enabled.
    The YAML file for the new operator appdevexperience-operator was created at
    /tmp/tmp.bI7H1qagGa/cloudrun.yaml
    customresourcedefinition.apiextensions.k8s.io/cloudruns.operator.run.cloud.google.com
    condition met
    kubeconfig entry generated for my-gke-cluster.
    Added the custom resource for Knative serving
    
    Waiting for Knative serving serving to be ready...
    Knative serving serving is not ready yet.
    Knative serving serving is ready.
    
    Removing the ValidatingWebhookConfiguration used to prevent deletion
    validatingwebhookconfiguration.admissionregistration.k8s.io
    "prevent-deletion-cloud-run-resources" deleted
    
    Knative serving has been installed as an Anthos fleet component
    

    비공개 클러스터의 알려진 문제

    Knative serving이 Google Cloud의 비공개 클러스터에 설치된 경우 시간 초과 오류가 발생할 수 있습니다.

    Waiting for CRD cloudruns.operator.run.cloud.google.com to be created
    

    시간 초과 오류를 해결하려면 다음 명령어를 실행합니다.

    cat <<EOF | kubectl apply -f -
    apiVersion: operator.run.cloud.google.com/v1alpha1
    kind: CloudRun
    metadata:
      name: cloud-run
    EOF
    
  3. Knative serving 기능 구성요소가 사용 설정되어 있는지 확인합니다.

    Console

    Google Cloud 콘솔에서 Knative serving 구성요소가 사용 설정되어 있는지 확인합니다.

    GKE Enterprise 기능으로 이동

    명령줄

    appdevexperience 상태가 ACTIVE인지 확인합니다.

    gcloud alpha container hub features list  --project=PROJECT_ID
    

    PROJECT_ID를 Google Cloud 프로젝트의 ID로 바꿉니다.

    자세한 내용과 추가 옵션은 gcloud alpha 컨테이너 허브 특성 목록을 참조하세요.

다음 단계

이제 Anthos Service Mesh 및 Knative serving이 설치되었으므로 트래픽을 새 리소스로 마이그레이션 및 출시할 수 있습니다.

롤백

위 단계를 통해 수행한 변경사항을 롤백해야 할 경우 마이그레이션 스크립트를 사용하여 다음을 수행할 수 있습니다.

  • appdevexperience-operator 연산자에서 Knative serving 리소스 제어를 삭제합니다.
  • Knative serving 커스텀 리소스를 삭제하고 appdevexperience-operator 연산자를 제거합니다.
  • 선택사항: Google Cloud 프로젝트의 Fleet에서 Knative serving을 사용 중지합니다.

롤백 프로세스를 시작하려면 다음 안내를 따르세요.

  1. 다음 명령어를 실행하여 마이그레이션 스크립트를 시작합니다.

    ./migration-addon.sh --command rollback-install-cloud-run-v2
    
  2. 터미널에서 마이그레이션 스크립트는 각 작업 수행을 확인하라는 메시지를 표시합니다. 각 프롬프트에서 y를 입력하여 작업을 계속합니다.

    Fleet 구성요소를 제거하는 과정에서 프롬프트는 다음과 유사합니다.

    In the step of rolling back the Knative serving fleet installation, the
    script performs the following:
    1. Remove control of Knative serving resources from the operator
       `appdevexperience-operator`.
    2. Delete the Knative serving custom resource and uninstall the operator
       `appdevexperience-operator`.
    3. Revert the changes installed by the Knative serving fleet component.
    4. Optional: Disable Knative serving in the GKE Enterprise fleet of your
       Google Cloud project.
    Continue? [Y/n] y
    
    1. Removing control of Knative serving resources from the operator
       `appdevexperience-operator`.
    
    Creating a ValidatingWebhookConfiguration to prevent the deletion of the
    resources under the following namespaces:
    knative-serving, cloud-run-system, and gke-system
    
    waiting for OwnerReferences of Knative serving resources to be deleted
    
    OwnerReferences of Knative serving resources are deleted
    
    Waiting for Knative serving serving to be ready...
    Knative serving serving is ready.
    
    2. Delete the Knative serving custom resource and uninstall the operator
       `appdevexperience-operator`?
    Continue? [Y/n] y
    
    cloudrun.operator.run.cloud.google.com "cloud-run" deleted
    clusteractiveoperand.operand.run.cloud.google.com/sha256-3c1c80a329 patched
    
    waiting for appdevexperience namespace to be deleted
    
    3. Revert the changes installed by the fleet component?
    configmap/config-observability patched
    
    4. Optional: Disable Knative serving in the Anthos fleet of your
       Google Cloud project?
       You can choose to skip this step and keep the feature enable within your
       Anthos fleet. For example, you might want to keep the
       Knative serving fleet component enabled because it was enabled prior to
       this migration.
    Continue (or Skip)? [Y/n] n