将 Apigee Hybrid 升级到 1.7 版

升级到 1.7.6 版概览。

以下各部分介绍升级 Apigee Hybrid 的过程:

  1. 准备升级到 1.7 版
  2. 安装 Hybrid 运行时 1.7.6 版
  3. 升级 cert-manager
  4. 升级 ASM

前提条件

以下升级说明假定您已安装 Apigee Hybrid 1.6.x 版或更早的 1.7.x 补丁版本,并希望升级到 1.7.6 版。如果您要从更低版本进行更新,请参阅将 Apigee Hybrid 升级到 1.6 版的说明。

准备升级到 1.7 版

备份 Hybrid 安装

  1. 以下说明将环境变量 $APIGEECTL_HOME 用于文件系统中安装 apigeectl 实用程序的目录。如果需要,请使用 cd 进入 apigeectl 目录,然后使用以下命令定义变量:
    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME
    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME
    set APIGEECTL_HOME=%CD%
    echo %APIGEECTL_HOME%
  2. (推荐)创建 1.6 版 $APIGEECTL_HOME/ 目录的备份副本。例如:
    tar -czvf $APIGEECTL_HOME/../apigeectl-v1.6-backup.tar.gz $APIGEECTL_HOME
  3. (推荐)按照 Cassandra 备份和恢复中的说明备份 Cassandra 数据库。

升级 Kubernetes 版本

将 Kubernetes 平台升级到 Hybrid 1.7 支持的版本。如需帮助,请参阅该平台的相关文档。

Apigee Hybrid 版本

平台

1.6(4) 不支持 1.7 1.8
Anthos (Google Cloud - GKE) 1.19.x
1.20.x
1.21.x
1.20.x
1.21.x
1.22.x (≥ 1.7.2)
1.23.x (≥ 1.7.2)
1.21.x (≤ 1.8.3)
1.22.x (≤ 1.8.3)
1.23.x (≤ 1.8.4)
1.24.x (≥ 1.8.4)
1.25.x (≥ 1.8.4)
Anthos (AWS) 1.7.x
1.8.x
1.9.3+
1.10.x
1.9.x
1.10.x
1.12.x (≥ 1.7.2)
1.10.x
1.11.x
1.12.x
1.13.x
1.14.x
Anthos (Azure) 1.8.x 1.9.x
1.10.x
1.12.x (≥ 1.7.2)
1.10.x
1.11.x
1.12.x
1.13.x
1.14.x
Anthos(1)(本地 - VMware) 1.7.x
1.8.x
1.9.3+
1.10.x
1.9.x 不支持(7)
1.10.x 不支持(7)
1.11.x 不支持(7) (≥ 1.7.2)
1.12.x 不支持(7) (≥ 1.7.2)
1.10.x 不支持(7)
1.11.x 不支持(7)
1.12.x 不支持(7) (5)
1.13.x (5)
1.14.x (5)
1.15.x
Anthos(1)(裸机) 1.7.x
1.8.2+
1.9.3+
1.10.x
1.9.x 不支持(7)
1.10.x 不支持(7)
1.11.x 不支持(7) (≥ 1.7.2)
1.12.x 不支持(7) (≥ 1.7.2)
1.10.x 不支持(7)
1.11.x 不支持(7)
1.12.x 不支持(7) (5)
1.13.x (5)
1.14.x (5)
1.15.x
Anthos(使用 Anthos 关联集群的 EKS 上的多云环境) 1.19.x
1.20.x
1.21.x
1.21.x
1.22.x (≥ 1.7.2)
1.23.x (≥ 1.7.2)
1.22.x (≤ 1.8.3)
1.23.x (≤ 1.8.4)
1.24.x (≥ 1.8.4)
1.25.x (≥ 1.8.4)
Anthos(使用 Anthos 关联集群的 AKS 上的多云环境) 1.19.x
1.20.x
1.21.x
1.21.x
1.22.x (≥ 1.7.2)
1.23.x (≥ 1.7.2)
1.22.x (≤ 1.8.3)
1.23.x (≤ 1.8.4)
1.24.x (≥ 1.8.4)
1.25.x (≥ 1.8.4)
Anthos(使用 Anthos 关联集群的 OpenShift 上的多云环境) 4.6
4.7
4.8
4.7
4.8
4.8
4.9
4.10
Anthos(使用 Anthos 关联集群的 Konvoy 上的多云环境) 1.7.x 不适用 不适用

组件

1.6 1.7 1.8
Anthos Service Mesh (ASM) 1.9.x 不支持
1.10.x 不支持
1.12.x 不支持(2)
1.10.x 不支持
1.11.x 不支持
1.12.x 不支持
1.13.x(3)
1.11.x 不支持
1.12.x 不支持
1.13.x
1.14.x 不支持
1.15.x
JDK JDK 11 JDK 11 JDK 11
cert-manager 1.5.4 1.7.x 1.7.x
Cassandra 3.11.10 3.11.10 3.11.10

(1) 在 Anthos 1.8.2 及更高版本中,请按照这些文档中的说明操作,以避免与 cert-manager 发生冲突

(2) Apigee Hybrid 1.6.6 版及更高版本提供支持

(3) Apigee Hybrid 1.7.2 版及更高版本提供支持

(4) 已达到 Apigee Hybrid 1.6、1.7 和 1.8 版的官方服务终止 (EOL) 日期。定期每月发布的补丁不再提供。这些版本不再受官方支持,但存在可以继续获得支持的明确的官方例外情况的客户除外。其他客户必须升级

(5) Anthos on Bare Metal 和 VMWare 需要 ASM 1.14 或更高版本。我们建议您升级到 Hybrid v1.8 并切换到 Apigee 入站流量网关,该网关不再需要您在混合集群上安装 ASM。

(6) Apigee Hybrid 1.8.4 版及更高版本提供支持

(7) Anthos on Bare Metal 和 VMWare 1.12 版及更低版本不再受支持。请参阅 Anthos on Bare Metal 版本支持政策Anthos Clusters on VMware 版本

(8) Apigee Hybrid 1.8.4 版及更高版本不支持

(9) Apigee Hybrid 1.7.6 版及更高版本提供支持

(10) Apigee Hybrid 1.8.5 版及更高版本不支持

关联集群简介

对于 Apigee Hybrid 1.7.x 版及更早版本,如果您要在 Elastic Kubernetes Service (EKS)、Azure Kubernetes Service (AKS) 或其他受支持的第三方 Kubernetes 服务提供商的多云环境中运行 Apigee Hybrid,则必须使用 Anthos 关联的集群。集群关联使 Google 可以衡量 Anthos Service Mesh (ASM) 的使用情况。注册第三方集群是可选选项。仅当您希望在 Google Cloud 控制台中查看关联集群时才应注册。如需了解详情,请参阅将第三方 Kubernetes 集群关联到 Google Cloud

对于 Apigee Hybrid 1.8.x 版,如果您要将 Anthos Service Mesh 用于入站流量网关,则 Anthos 关联的集群是必需的。如果您使用的是 Apigee 入站流量网关,则 Anthos 关联的集群是可选的。

Cloud Trace Agent 角色添加到 apigee-runtime 服务账号

可选:如果您计划使用 Cloud Trace,请确保您的 apigee-runtime 服务账号拥有 Cloud Trace Agent (roles/cloudtrace.agent) Google 角色。您可以在 Cloud 控制台 > IAM 和管理 > 服务账号界面中或使用以下命令执行此操作:

  1. 使用以下命令获取 apigee-runtime 服务账号的电子邮件地址:
    gcloud iam service-accounts list --filter "apigee-runtime"

    如果它与模式 apigee-runtime@$ORG_NAME.iam.gserviceaccount.com 匹配,您可以在下一步中使用该模式。

  2. Cloud Trace Agent 角色分配给服务账号:
    gcloud projects add-iam-policy-binding $PROJECT_ID \
        --member="serviceAccount:apigee-runtime@$PROJECT_ID.iam.gserviceaccount.com" \
        --role="roles/cloudtrace.agent"

    其中,$PROJECT_ID 是安装了 Apigee Hybrid 的 Google Cloud 项目的名称。

替换覆盖对象中的 metrics:stackdriverExporter 属性。

从 Hybrid 1.7 版开始,metrics:stackdriverExporter 已被替换为 metrics:appStackdriverExportermetrics:proxyStackdriverExporter。将这些属性替换为等效属性。例如,将:

metrics:
  ... ...
  stackdriverExporter:
    resources:
      limits:
        cpu: 500m
        memory: 1Gi
      requests:
        cpu: 128m
        memory: 512Mi

替换为:

metrics:
  ... ...
  appStackdriverExporter:
    resources:
      limits:
        cpu: 500m
        memory: 1Gi
      requests:
        cpu: 128m
        memory: 512Mi
  proxyStackdriverExporter:
    resources:
      limits:
        cpu: 500m
        memory: 1Gi
      requests:
        cpu: 128m
        memory: 512Mi

请参阅配置属性参考:指标

安装 Hybrid 1.7.6 运行时

  1. 使用以下命令将最新版本号存储在变量中:
    export VERSION=$(curl -s \
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt?ignoreCache=1)
    export VERSION=$(curl -s \
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt)
    for /f "tokens=*" %a in ('curl -s ^
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt') ^
    do set VERSION=%a
  2. 使用以下命令检查该变量是否已填充版本号。如果要使用其他版本,您可以改为将其保存在环境变量中。
    echo $VERSION
      1.7.6
  3. 确保您位于 Hybrid 基本目录中(apigeectl 可执行文件所在目录的父级目录):
    cd $APIGEECTL_HOME/..
  4. 使用以下命令下载适用于您的操作系统的软件包版本。请务必在下表中选择您的平台:

    Linux 64 位

    curl -LO \
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/$VERSION/apigeectl_linux_64.tar.gz

    Mac 64 位

    curl -LO \
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/$VERSION/apigeectl_mac_64.tar.gz

    Windows 64 位

    curl -LO ^
      https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/%VERSION%/apigeectl_windows_64.zip
  5. 将当前 apigeectl/ 目录重命名为备份目录名称。例如:
    mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.6/
    mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.6/ 
    rename %APIGEECTL_HOME% %APIGEECTL_HOME%-v1.6 
  6. 将下载的 gzip 文件内容解压缩到 Hybrid 基本目录中。Hybrid 基本目录是重命名后的 apigeectl-v1.6 目录所在的目录:

    tar xvzf filename.tar.gz -C ./
    tar xvzf filename.tar.gz -C ./
    tar xvzf filename.zip -C ./
  7. 默认情况下,tar 内容会扩展到其名称中包含版本和平台的目录。例如:./apigeectl_1.7.6-d591b23_linux_64。使用以下命令将该目录重命名为 apigeectl

    mv directory-name-linux apigeectl
    mv directory-name-mac apigeectl
    rename directory-name-windows apigeectl
  8. 切换到 apigeectl 目录:
    cd ./apigeectl

    apigeectl 可执行文件位于此目录中。

  9. 以下说明将环境变量 $APIGEECTL_HOME 用于文件系统中安装 apigeectl 实用程序的目录。如果需要,请使用 cd 进入 apigeectl 目录,然后使用以下命令定义变量:
    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME
    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME
    set APIGEECTL_HOME=%CD%
    echo %APIGEECTL_HOME%
  10. 使用 version 命令验证 apigeectl 的版本:
    ./apigeectl version
    Version: 1.7.6
  11. 移至 hybrid-base-directory/hybrid-files 目录。hybrid-files 目录是替换文件、证书和服务账号等配置文件所在的位置。例如:
    cd $APIGEECTL_HOME/../hybrid-files
  12. 使用以下命令验证 kubectl 是否设置为正确的上下文。当前上下文应设置为您要在其中升级 Apigee Hybrid 的集群。
    kubectl config get-contexts | grep \*
  13. hybrid-files 目录中:
    1. 将以下符号链接更新为 $APIGEECTL_HOME。这些链接使您可以从 hybrid-files 目录中运行新安装的 apigeectl 命令:
      ln -nfs $APIGEECTL_HOME/tools tools
      ln -nfs $APIGEECTL_HOME/config config
      ln -nfs $APIGEECTL_HOME/templates templates
      ln -nfs $APIGEECTL_HOME/plugins plugins
    2. 要检查符号链接是否正确创建,请执行以下命令,并确保链接路径指向正确的位置:
      ls -l | grep ^l
    3. 执行试运行初始化以检查是否存在错误:
      ${APIGEECTL_HOME}/apigeectl init -f ./overrides/OVERRIDES.yaml --dry-run=client

      其中,OVERRIDES 是替换文件的名称。

    4. 如果没有错误,请初始化 Hybrid 1.7.6:
      ${APIGEECTL_HOME}/apigeectl init -f ./overrides/OVERRIDES.yaml
    5. 检查初始化状态:
      ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
    6. 试运行 apply 命令以检查是否存在错误:
      ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --dry-run=client
    7. 如果没有错误,则应用替换文件。选择生产环境或演示/实验环境的相关说明并按照这些说明操作,具体取决于您的安装。

      对于生产环境,您应该单独升级每个 Hybrid 组件,并检查升级后的组件的状态,再继续升级下一个组件。

      1. 确保您位于 hybrid-files 目录中。
      2. 应用替换文件以升级 Cassandra:
        ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --datastore
      3. 检查完成情况:
        ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml

        仅当 Pod 准备就绪后,才继续执行下一步。

      4. 应用替换文件以升级遥测组件和检查完成情况:
        ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --telemetry
        ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
      5. 启动 Redis 组件:
        ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --redis
      6. 应用替换文件以升级组织层级组件(MART、Watcher 和 Apigee Connect)并检查完成情况:
        ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --org
        ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
      7. 应用替换文件以升级您的环境。您有以下两种选择:
        • 对每个环境逐一应用:每次将替换文件应用于一个环境,然后检查完成情况。对每个环境重复执行此步骤:
          ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --env ENV_NAME
          ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml

          其中,ENV_NAME 是您要升级的环境的名称。

        • 同时应用于所有环境:将替换文件同时应用于所有环境,然后检查完成情况:
          ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --all-envs
          ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml

      在大多数演示或实验环境中,您可以将替换文件同时应用于所有组件。如果您的演示/实验环境大且复杂或非常类似于生产环境,则可能需要使用升级生产环境的说明

      1. 确保您位于 hybrid-files 目录中。
      2. ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml
      3. 检查状态:
        ${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml

将 cert-manager 升级到 v1.7.2 版

如果您运行的是 v1.7.2 之前的 cert-manager 版本,则需要将其升级到 v1.7.2。

  1. 使用以下命令检查 cert-manager 的当前版本:

    kubectl -n cert-manager get deployment -o yaml | grep 'image:'
    

    将会返回类似如下的内容:

    image: quay.io/jetstack/cert-manager-controller:v1.7.2
    image: quay.io/jetstack/cert-manager-cainjector:v1.7.2
    image: quay.io/jetstack/cert-manager-webhook:v1.7.2
  2. 使用以下命令移除部署:
    $ kubectl delete -n cert-manager deployment cert-manager cert-manager-cainjector cert-manager-webhook
    
  3. 使用以下命令将 cert-manager 升级到 v1.7.2 版:
    $ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.2/cert-manager.yaml
    

将 ASM 升级到 1.12版

使用适合您的平台的 ASM 文档执行升级:

安装和配置 ASM 的说明因平台而异。这些平台分为以下几种类别:

  • GKE:在 Google Cloud 上运行的 Google Kubernetes Engine 集群。
  • Google Cloud 外部:在以下位置运行的 Anthos 集群:
    • Anthos clusters on VMware (GKE on-prem)
    • Anthos on Bare Metal
    • Anthos clusters on AWS
    • Amazon EKS
  • 其他 Kubernetes 平台:在以下平台上创建和运行的合规集群:
    • AKS
    • EKS
    • OpenShift

为 Hybrid 安装升级到 ASM 1.12.9 版的顺序如下:

  1. 准备升级。
  2. 安装新版 ASM。
  3. 从当前安装中删除先前 ASM 版本的部署、服务和网络钩子。
  4. 升级网关并配置新的网络钩子。

如需升级到 GKE 上 Hybrid 的 ASM 1.12.9 版,请运行以下命令:

  1. 查看升级 Anthos Service Mesh 中的要求,但尚不执行升级。
  2. 在安装新版本之前,确定当前修订版本。您需要使用此信息从当前安装中删除先前 ASM 版本的部署、服务和网络钩子。使用以下命令将当前 istiod 修订版本存储到环境变量中:
    export DELETE_REV=$(kubectl get deploy -n istio-system -l app=istiod -o jsonpath={.items[].metadata.labels.'istio\.io\/rev'}'{"\n"}')
    echo ${DELETE_REV}
  3. 创建新的 overlay.yaml 文件,或验证现有 overlay.yaml 是否包含以下内容:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      revision: asm-1129-3
      components:
        ingressGateways:
          - name: istio-ingressgateway
            enabled: true
            k8s:
              nodeSelector:
                # default node selector, if different or not using node selectors, change accordingly.
                cloud.google.com/gke-nodepool: apigee-runtime
              resources:
                requests:
                  cpu: 1000m
              service:
                type: LoadBalancer
                loadBalancerIP: STATIC_IP # If you do not have a reserved static IP, leave this out.
                ports:
                  - name: http-status-port
                    port: 15021
                  - name: http2
                    port: 80
                    targetPort: 8080
                  - name: https
                    port: 443
                    targetPort: 8443
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  4. 按照 ASM 文档中以下部分的说明操作:
    1. 下载 asmcli
    2. 授予集群管理员权限
    3. 验证项目和集群
    4. 使用可选功能升级。在开始执行“升级网关”部分之前停止
  5. 删除变更网络钩子和验证网络钩子:
    1. 使用 cd 进入 asmcli 的安装目录。
    2. 将当前新修订版本存储在环境变量中,以便用于删除网络钩子的脚本:
      UPGRADE_REV="asm-1129-3"
    3. 创建一个包含以下命令的 Shell 脚本:
      #!/bin/bash
      
      set -ex
      
      PROJECT_ID="YOUR_PROJECT_ID"
      CLUSTER_NAME="YOUR_CLUSTER_NAME"
      CLUSTER_LOCATION="YOUR_CLUSTER_LOCATION"
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAY/istio-ingressgateway-connectors
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 执行此脚本以删除当前网络钩子。
  6. 按照升级网关中的步骤创建新的网络钩子,并将流量切换到新网关。

下面的说明介绍了如何在以下位置升级 ASM:

  • Anthos clusters on VMware (GKE on-prem)
  • Anthos on Bare Metal
  • Anthos clusters on AWS
  • Amazon EKS

为 Hybrid 安装升级到 ASM 1.12.9 版的顺序如下:

  1. 准备升级。
  2. 安装新版 ASM。
  3. 从当前安装中删除先前 ASM 版本的部署、服务和网络钩子。
  4. 升级网关并配置新的网络钩子。
  1. 查看升级 Anthos Service Mesh 中的要求,但尚不执行升级。
  2. 在安装新版本之前,确定当前修订版本。您需要使用此信息从当前 ASM 安装中删除验证网络钩子和变更网络钩子。使用以下命令将当前 istiod 修订版本存储到环境变量中:
    export DELETE_REV=$(kubectl get deploy -n istio-system -l app=istiod -o jsonpath={.items[].metadata.labels.'istio\.io\/rev'}'{"\n"}')
    echo ${DELETE_REV}
  3. 创建新的 overlay.yaml 文件,或验证现有 overlay.yaml 是否包含以下内容:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      revision: asm-1129-3
      components:
        ingressGateways:
          - name: istio-ingressgateway
            enabled: true
            k8s:
              nodeSelector:
                # default node selector, if different or not using node selectors, change accordingly.
                cloud.google.com/gke-nodepool: apigee-runtime
              resources:
                requests:
                  cpu: 1000m
              service:
                type: LoadBalancer
                loadBalancerIP: STATIC_IP # If you do not have a reserved static IP, leave this out.
                ports:
                  - name: http-status-port
                    port: 15021
                  - name: http2
                    port: 80
                    targetPort: 8080
                  - name: https
                    port: 443
                    targetPort: 8443
      values:
        gateways:
          istio-ingressgateway:
            runAsRoot: true
    
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  4. 按照 ASM 文档中以下部分的说明操作:
    1. 下载 asmcli
    2. 授予集群管理员权限
    3. 验证项目和集群
    4. 使用可选功能升级。在开始执行“升级网关”部分之前停止
  5. 删除变更网络钩子和验证网络钩子:
    1. 使用 cd 进入 asmcli 的安装目录。
    2. 将当前新修订版本存储在环境变量中,以便用于删除网络钩子的脚本:
      UPGRADE_REV="asm-1129-3"
    3. 创建一个包含以下命令的 Shell 脚本:
      #!/bin/bash
      
      set -ex
      
      PROJECT_ID="YOUR_PROJECT_ID"
      CLUSTER_NAME="YOUR_CLUSTER_NAME"
      CLUSTER_LOCATION="YOUR_CLUSTER_LOCATION"
      
      
      gcloud config configurations activate ${PROJECT_ID}
      gcloud container clusters get-credentials ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID}
      
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAY/istio-ingressgateway-connectors
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 执行此脚本以删除当前网络钩子。
  6. 按照升级网关中的步骤创建新的网络钩子,并将流量切换到新网关。

在这些说明中,在 Anthos 关联的集群上升级 Anthos Service Mesh (ASM) istio-1.12.9-asm.3 版的过程与执行全新安装相同。

准备安装 Anthos Service Mesh

  1. 删除变更网络钩子和验证网络钩子:
    1. 使用 cd 进入 asmcli 的安装目录。
    2. 将当前新修订版本存储在环境变量中,以便用于删除网络钩子的脚本:
      UPGRADE_REV="asm-1129-3"
    3. 创建一个包含以下命令的 Shell 脚本:
      #!/bin/bash
      
      set -ex
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 执行此脚本以删除当前网络钩子。
  2. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-linux-amd64.tar.gz
  3. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-linux-amd64.tar.gz.1.sig
    openssl dgst -verify /dev/stdin -signature istio-1.12.9-asm.3-linux-amd64.tar.gz.1.sig istio-1.12.9-asm.3.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  4. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-linux-amd64.tar.gz

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests/profiles 目录中。
  5. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  6. 为方便起见,请将 /bin 目录中的工具添加到 PATH:
    export PATH=$PWD/bin:$PATH
  7. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-osx.tar.gz
  8. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-osx.tar.gz.1.sig
    openssl dgst -sha256 -verify /dev/stdin -signature istio-1.12.9-asm.3-osx.tar.gz.1.sig istio-1.12.9-asm.3.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  9. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-osx.tar.gz

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests/profiles 目录中。
  10. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  11. 为方便起见,请将 /bin 目录中的工具添加到 PATH:
    export PATH=$PWD/bin:$PATH
  12. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-win.zip
  13. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-win.zip.1.sig
    openssl dgst -verify - -signature istio-1.12.9-asm.3-win.zip.1.sig istio-1.12.9-asm.3.win.zip <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  14. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-win.zip

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests\profiles 目录中。
  15. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  16. 为方便起见,请将 \bin 目录中的工具添加到 PATH:
    set PATH=%CD%\bin:%PATH%
  17. 现在,ASM Istio 已安装,请检查 istioctl 的版本:
    istioctl version
  18. 为控制平面组件创建一个名为 istio-system 的命名空间:
    kubectl create namespace istio-system

安装 Anthos Service Mesh

  1. 修改 overlay.yaml 文件或创建包含以下内容的新文件:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      meshConfig:
        accessLogFile: /dev/stdout
        enableTracing: true
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
      components:
      - enabled: true
        name: istio-ingressgateway
        k8s:
          service:
            type: LoadBalancer
            ports:
            - name: status-port
              port: 15021
              targetPort: 15021
            - name: http2
              port: 80
              targetPort: 8080
            - name: https
              port: 443
              targetPort: 8443
    
  2. 使用 asm-multicloud 配置文件,利用 istioctl 来安装 Anthos Service Mesh:
    istioctl install \
        --set profile=asm-multicloud \
        --set revision="asm-1129-3" \
        --filename overlayfile.yaml

    输出应如下所示:

    kubectl get pods -n istio-system
    NAME                                   READY   STATUS    RESTARTS   AGE
    istio-ingressgateway-88b6fd976-flgp2   1/1     Running   0          3m13s
    istio-ingressgateway-88b6fd976-p5dl9   1/1     Running   0          2m57s
    istiod-asm-1129-3-798ffb964-2ls88       1/1     Running   0          3m21s
    istiod-asm-1129-3-798ffb964-fnj8c       1/1     Running   1          3m21s

    --set revision 参数会将格式为 istio.io/rev=asm-1129-3 的修订版本标签添加到 istiod。自动边车注入器网络钩子使用修订版本标签将注入的边车与特定 istiod 修订版本相关联。如需为命名空间启用边车自动注入功能,您必须使用一个与 istiod 上的标签匹配的修订版本来为其添加标签。

  3. 验证安装是否已完成:
    kubectl get svc -n istio-system

    输出应如下所示:

    NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                                                                      AGE
    istio-ingressgateway   LoadBalancer   172.200.48.52    34.74.177.168   15021:30479/TCP,80:30030/TCP,443:32200/TCP,15012:32297/TCP,15443:30244/TCP   3m35s
    istiod                 ClusterIP      172.200.18.133   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        4m46s
    istiod-asm-1129-3       ClusterIP      172.200.63.220   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        3m43s

在这些说明中,在 Anthos 关联的集群上升级 Anthos Service Mesh (ASM) istio-1.12.9-asm.3 版的过程与执行全新安装相同。

准备安装 Anthos Service Mesh

  1. 删除变更网络钩子和验证网络钩子:
    1. 使用 cd 进入 asmcli 的安装目录。
    2. 将当前新修订版本存储在环境变量中,以便用于删除网络钩子的脚本:
      UPGRADE_REV="asm-1129-3"
    3. 创建一个包含以下命令的 Shell 脚本:
      #!/bin/bash
      
      set -ex
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAY/istio-ingressgateway-connectors
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 执行此脚本以删除当前网络钩子。
  2. 使用以下 OpenShift CLI (oc) 命令向 istio-system 授予 anyuid 安全上下文限制条件 (SCC):
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  3. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-linux-amd64.tar.gz
  4. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-linux-amd64.tar.gz.1.sig
    openssl dgst -verify /dev/stdin -signature istio-1.12.9-asm.3-linux-amd64.tar.gz.1.sig istio-1.12.9-asm.3.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  5. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-linux-amd64.tar.gz

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests/profiles 目录中。
  6. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  7. 为方便起见,请将 /bin 目录中的工具添加到 PATH:
    export PATH=$PWD/bin:$PATH
  8. 使用以下 OpenShift CLI (oc) 命令向 istio-system 授予 anyuid 安全上下文限制条件 (SCC):
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  9. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-osx.tar.gz
  10. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-osx.tar.gz.1.sig
    openssl dgst -sha256 -verify /dev/stdin -signature istio-1.12.9-asm.3-osx.tar.gz.1.sig istio-1.12.9-asm.3.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  11. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-osx.tar.gz

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests/profiles 目录中。
  12. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  13. 为方便起见,请将 /bin 目录中的工具添加到 PATH:
    export PATH=$PWD/bin:$PATH
  14. 使用以下 OpenShift CLI (oc) 命令向 istio-system 授予 anyuid 安全上下文限制条件 (SCC):
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  15. 将 Anthos Service Mesh 安装文件下载到当前工作目录中:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-win.zip
  16. 下载签名文件并使用 openssl 验证签名:
    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.12.9-asm.3-win.zip.1.sig
    openssl dgst -verify - -signature istio-1.12.9-asm.3-win.zip.1.sig istio-1.12.9-asm.3.win.zip <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  17. 将文件内容提取到文件系统上的任意位置。例如,如需将内容提取到当前工作目录,请运行以下命令:
    tar xzf istio-1.12.9-asm.3-win.zip

    该命令会在当前工作目录中创建一个名为 istio-1.12.9-asm.3 的安装目录,其中包含:

    • samples 目录中的示例应用。
    • 用于安装 Anthos Service Mesh 的 istioctl 命令行工具位于 bin 目录中。
    • Anthos Service Mesh 配置文件位于 manifests\profiles 目录中。
  18. 确保您位于 Anthos Service Mesh 安装的根目录。
    cd istio-1.12.9-asm.3
  19. 为方便起见,请将 \bin 目录中的工具添加到 PATH:
    set PATH=%CD%\bin:%PATH%
  20. 现在,ASM Istio 已安装,请检查 istioctl 的版本:
    istioctl version
  21. 为控制平面组件创建一个名为 istio-system 的命名空间:
    kubectl create namespace istio-system

安装 Anthos Service Mesh

  1. 修改 overlay.yaml 文件或创建包含以下内容的新文件:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      meshConfig:
        accessLogFile: /dev/stdout
        enableTracing: true
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
      components:
      - enabled: true
        name: istio-ingressgateway
        k8s:
          service:
            type: LoadBalancer
            ports:
            - name: status-port
              port: 15021
              targetPort: 15021
            - name: http2
              port: 80
              targetPort: 8080
            - name: https
              port: 443
              targetPort: 8443
    
  2. 使用 asm-multicloud 配置文件,利用 istioctl 来安装 Anthos Service Mesh:
    istioctl install \
        --set profile=asm-multicloud \
        --set revision="asm-1129-3" \
        --filename overlayfile.yaml

    输出应如下所示:

    kubectl get pods -n istio-system
    NAME                                   READY   STATUS    RESTARTS   AGE
    istio-ingressgateway-88b6fd976-flgp2   1/1     Running   0          3m13s
    istio-ingressgateway-88b6fd976-p5dl9   1/1     Running   0          2m57s
    istiod-asm-1129-3-798ffb964-2ls88       1/1     Running   0          3m21s
    istiod-asm-1129-3-798ffb964-fnj8c       1/1     Running   1          3m21s

    --set revision 参数会将格式为 istio.io/rev=1.6.11-asm.1 的修订版本标签添加到 istiod。自动边车注入器网络钩子使用修订版本标签将注入的边车与特定 istiod 修订版本相关联。如需为命名空间启用边车自动注入功能,您必须使用一个与 istiod 上的标签匹配的修订版本来为其添加标签。

  3. 验证安装是否已完成:
    kubectl get svc -n istio-system

    输出应如下所示:

    NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                                                                      AGE
    istio-ingressgateway   LoadBalancer   172.200.48.52    34.74.177.168   15021:30479/TCP,80:30030/TCP,443:32200/TCP,15012:32297/TCP,15443:30244/TCP   3m35s
    istiod                 ClusterIP      172.200.18.133   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        4m46s
    istiod-asm-1129-3       ClusterIP      172.200.63.220   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        3m43s

回滚升级

要回滚以前的升级,请按以下步骤操作:

  1. 清理混合运行时命名空间的已完成作业,其中 NAMESPACE 是替换文件中指定的命名空间(如果您指定了命名空间)。如果没有,则默认命名空间为 apigee
    kubectl delete job -n NAMESPACE \
      $(kubectl get job -n NAMESPACE \
      -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
  2. apigee-system 命名空间清理已完成作业:
    kubectl delete job -n apigee-system \
      $(kubectl get job -n apigee-system \
      -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
  3. 更改 APIGEECTL_HOME 变量,使其指向包含先前版本 apigeectl 的目录。例如:
    export APIGEECTL_HOME=PATH_TO_PREVIOUS_APIGEECTL_DIRECTORY
  4. 在要回滚到的安装的根目录中,运行 ${APIGEECTL_HOME}/apigeectl apply,检查 pod 的状态,然后运行 ${APIGEECTL_HOME}/apigeectl init。对于要回滚到的版本,请务必使用原始替换文件:
    1. hybrid-files 目录中,运行 ${APIGEECTL_HOME}/apigeectl apply
      ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/ORIGINAL_OVERRIDES.yaml

      其中,ORIGINAL_OVERRIDES 是先前版本 Hybrid 安装的替换文件,例如 overrides1.6.yaml

    2. 检查您的 Pod 的状态:
      kubectl -n NAMESPACE get pods

      其中,NAMESPACE 是您的 Apigee Hybrid 命名空间。

    3. 检查 apigeeds 的状态:
      kubectl describe apigeeds -n apigee

      输出应如下所示:

      Status:
        Cassandra Data Replication:
        Cassandra Pod Ips:
          10.8.2.204
        Cassandra Ready Replicas:  1
        Components:
          Cassandra:
            Last Successfully Released Version:
              Revision:  v1-f8aa9a82b9f69613
              Version:   v1
            Replicas:
              Available:  1
              Ready:      1
              Total:      1
              Updated:    1
            State:        running
        Scaling:
          In Progress:         false
          Operation:
          Requested Replicas:  0
        State:                 running

      仅当 apigeeds pod 正在运行时才继续执行下一步。

    4. 运行 apigeectl init
      ${APIGEECTL_HOME}/apigeectl init -f ./overrides/ORIGINAL_OVERRIDES.yaml