bmctl 指令參考資料

bmctl 是 Google Distributed Cloud 的指令列工具,可簡化叢集建立和管理作業。本文件是 bmctl 指令和相關標記的完整參考資料。

事前準備

如果 location 未設為 globalbmctl 會使用應用程式預設憑證 (ADC) 驗證叢集規格 (clusterOperations.location) 中的 location 值。許多 bmctl 指令都需要這項驗證。如要使用 ADC,請採取下列任一做法:

  • 在管理工作站上,將 GOOGLE_APPLICATION_CREDENTIALS 環境變數設為服務帳戶憑證檔案的路徑。

  • 使用 gcloud CLI 使用者憑證做為應用程式預設憑證 (ADC):

    gcloud auth application-default login
    

部分 bmctl 指令可讓您使用旗標指定憑證檔案的路徑。

備份

備份叢集資訊。

選項

  -h, --help   help for backup

備份叢集

備份叢集,並將備份內容儲存到 tar 檔案中。

backup cluster [flags]

選項

      --backup-file string                      path to the output backup files.
      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for cluster
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.
      --use-disk                                Perform the backup using the disk instead of in-memory
                                                buffer. This option only works when the command is run
                                                by the root user or with sudo.
      --yes                                     Perform the backup and do not prompt for confirmation
                                                (non-interactive mode).

如要進一步瞭解如何使用 bmctl 備份及還原叢集,請參閱「使用 bmctl 備份及還原叢集」。

勾選

對叢集或基礎架構執行預檢或健康狀態檢查。

選項

  -h, --help   help for check

檢查外掛程式

檢查叢集外掛程式的運作健康狀態,例如 stackdriver-log-aggregatorstackdriver-log-forwardergke-connect-agent

check add-ons [flags]

範例

# Do a health check for add-ons
bmctl check add-ons --cluster=cluster1

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for add-ons
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

檢查叢集

檢查叢集健康狀態或產生叢集快照。

check cluster [flags]

範例

# Do a health check for cluster.
bmctl check cluster --cluster=cluster1
# Take a snapshot of the cluster (requires admin cluster to be available).
bmctl check cluster --snapshot --cluster=cluster1 --admin-kubeconfig=admin-kubeconfig
# Take a snapshot of the cluster (requires admin cluster to be available) using 30 threads.
bmctl check cluster --snapshot --cluster=cluster1 --admin-kubeconfig=admin-kubeconfig --num-of-parallel-threads=30
# Take a snapshot of the cluster nodes only (does not require admin cluster to be available).
bmctl check cluster --snapshot --cluster=cluster1 --snapshot-config=snapshot-config

選項

      --bootstrap-cluster-pod-cidr string           Bootstrap cluster pod CIDR (default "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string       Bootstrap cluster service CIDR (default "10.96.0.0/27")
      --ca-file string                              The file contains the Node Agent server CA certificate for authenticating nodes to capture snapshots. While this flag is fully optional, when provided, nodes must also be provided.
      --cert-file string                            The file contains the Node Agent client certificate for authenticating with nodes to capture snapshots. While this flag is fully optional, when provided, nodes must also be provided.
  -c, --cluster cluster name                        Cluster name, cluster config is expected to be placed under <workspace dir>/<cluster name>/<cluster name>.yaml
      --enforce-allowlist                           Enforces allowlist checking for kubectl/node commands executed as part of collecting snapshot that they are read-only. Commands not allowed will be skipped. (default true)
  -h, --help                                        help for cluster
      --ignore-validation-errors                    A validation error override, allowing to proceed despite the validation errors.
      --key-file string                             The file contains the Node Agent client private key for authenticating with nodes to capture snapshots. While this flag is fully optional, when provided, nodes must also be provided.
      --kubeconfig string                           Optional, path to the kubeconfig file for the admin cluster. IF not provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.
      --local                                       Save the snapshot on your workstation only. This will allow you to explicitly opt out of uploading the snapshot to Google Cloud.
      --login-user string                           The user to login to each node. This will be ignored when admin-kubeconfig is set. (default "root")
      --node-ssh-key string                         The file contains ssh key to the nodes to capture snapshots against. While this flag is fully optional, when provided, nodes must also be provided.
      --nodeagent-port int                          The Node Agent server port for the client side to connect to. This flag is optional and only applies with 'nodes' options; when provided, it will override the default port.
      --nodes strings                               The comma-separated IP address list of the nodes to capture snapshots against. While this flag is fully optional, when provided, node-ssh-key must also be provided.
      --num-of-parallel-threads int                 The number of parallel threads used for processing snapshots. Note that --snapshot-config and --num-of-parallel-threads flags cannot be used at the same time. (default 10)
      --quiet                                       During snapshot run suppress logging to stdout.  (Console log is available in 'bmctl_diagnose_snapshot.log' file part of the snapshot)
      --reuse-bootstrap-cluster                     If true, use existing bootstrap cluster.
      --service-account-key-file string             The service account key file that is needed to upload the snapshot to your Google Cloud Storage bucket and provision a dedicated Google Cloud service account for your project to facilitate snapshot sharing with Google.
                                                    Make sure that the service account key has the ability to create and list buckets and objects in your project.
                                                    We recommend creating a custom role with the following permissions and assigning this custom role to your service account:
                                                    - storage.buckets.create
                                                    - storage.buckets.get
                                                    - storage.buckets.list
                                                    - storage.objects.create
                                                    - resourcemanager.projects.get
                                                    Note that all the storage permissions fall under the "roles/storage.admin" IAM role. You can also use that role, but it is too powerful and is not recommended
                                                    Note that:
                                                    - this flag is defaulted to the environment variable GOOGLE_APPLICATION_CREDENTIALS, if not provided.
                                                    - this flag is ignored, if "--upload-to" flag is empty.
      --since duration                              This Only returns logs newer than a relative duration like 5s, 4m, or 3h. It defaults to all logs.
      --snapshot                                    Takes a snapshot of the cluster's logs, configurations and other data if true.
                                                    Note that if a service account key is provided either throuh the flag --service-account-key-file or GOOGLE_APPLICATION_CREDENTIALS, the snapshot will be automatically uploaded to your Google Cloud Storage bucket. Also, a dedicated Google Cloud service account for your project will be provisioned for your project to facilitate snapshot sharing with Google.
                                                    Use --local to opt out of snapshot uploading.
      --snapshot-config --enforce_allowlist=false   The config file of the snapshot. When this flag is omitted, a default configuration is applied. An allowlist enforcing read-only commands is in effect by default, to bypass it specify --enforce_allowlist=false option. Note that --snapshot-config and --num-of-parallel-threads flags cannot be used at the same time.
      --snapshot-dry-run                            In dry-run mode, the command does not take the snapshot. Instead, it prints out the actions to be taken and the snapshot configuration.
      --snapshot-output string                      The output file of the snapshot.
      --snapshot-scenario string                    The scenario of the snapshot. This is ignored when --config flag is specified. The supported scenarios are:
                                                    - system: snapshot of system components, including their logs
                                                    - all: snapshot of all pods, including their logs (default "system")
      --snapshot-temp-output-dir string             The temporary landing directory for snapshot.
      --upload-to string                            The Google Cloud Storage bucket name for uploading the snapshot. A new bucket will be created if it doesn't exist. Please follow the naming guidelines here(https://cloud.google.com/storage/docs/naming-buckets).

檢查設定

檢查叢集設定檔。

check config [flags]

範例

# Do check for cluster1.yaml file
bmctl check config --cluster=cluster1

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for config
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

check gcp

叢集與 Google Cloud 的連線健康狀態檢查。

check gcp [flags]

範例

# Do a machines' Google Cloud connectivity health check for cluster
bmctl check gcp --cluster=cluster1

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for gcp
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

檢查 Kubernetes

Kubernetes 健康狀態檢查。

check kubernetes [flags]

範例

# Do a kubernetes health check for cluster
bmctl check kubernetes --cluster=cluster1

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for kubernetes
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

檢查節點

檢查節點健康狀態。

check nodes [flags]

範例

# Do a health check for some provisioned nodes
bmctl check nodes --addresses=192.168.0.1,192.168.0.4

選項

      --addresses strings                       Node addresses, addresses should be a comma separated
                                                list, each address needs be a single IP address(e.g.,
                                                192.168.0.1)
      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for nodes
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

檢查預檢

預檢。

劇情概要

預檢。

check preflight [flags]

範例

# Do a preflight check for cluster1.yaml in bmctl-workspace/cluster1
bmctl check preflight --cluster=cluster1
# If kubeconfig flag (for example, --kubeconfig=bmctl-workspace/cluster1/cluster1-kubeconfig) is
# included, the command will trigger a preflight check for upgrading the cluster

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for preflight
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

check vmruntimepfc

GDC 預檢的 VM Runtime。

check vmruntimepfc [flags]

範例

# Do vmruntime preflight check,
    bmctl check vmruntimepfc --kubeconfig=$KUBECONFIG

選項

  -h, --help                help for vmruntimepfc
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

如要進一步瞭解預檢,請參閱「瞭解預檢檢查」。

設定

在 Google Cloud 上設定服務帳戶和 IAM 角色,並啟用 API,以進行 Workload Identity 叢集驗證。

選項

  -h, --help   help for configure

設定專案

設定工作負載身分叢集驗證的身分與存取權管理政策繫結。建立必要的服務帳戶,並啟用必要的 API。

configure projects [flags]

選項

      --admin-cluster string                admin cluster name
      --cloud-ops-service-account string    cloud ops service account
      --controller-service-account string   controller GCP service account
      --gcr-service-account string          GCR image pull service account
  -h, --help                                help for projects
      --location string                     GKE hub membership location (default "global")
      --project-id string                   GCP project used in GKE connect
      --proxy-url string                    proxy URL for accessing GCP services. If not specified,
                                            bmctl looks for env variables HTTPS_PROXY and HTTP_PROXY
      --user-clusters string                one or more comma-delimited user cluster names

如要進一步瞭解如何啟用及使用工作負載身分叢集驗證,請參閱「工作負載身分叢集驗證」。

create

建立叢集設定檔、叢集或 Kubernetes 服務帳戶 (KSA)。

選項

  -h, --help   help for create

建立叢集

從叢集設定檔建立叢集。

劇情概要

建立 Google Distributed Cloud 資源。這個指令會發出所建立叢集的 kubeconfig。請務必妥善保存這個檔案,因為檔案中含有叢集的憑證。這項指令需要 serviceusage.services.get 權限,才能檢查 Google Cloud 專案是否已啟用 API。

create cluster [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
      --force                                   If true, ignore errors from preflight checks and
                                                validation except for Google Cloud check errors.
  -h, --help                                    help for cluster
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

如要進一步瞭解如何建立叢集,請參閱「叢集建立方式總覽」一文。

建立設定

建立叢集設定檔。根據預設,這個檔案會在 bmctl-workspace/<cluster_name> 資料夾中建立。

create config [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
      --create-service-accounts                 Auto create GCP service accounts keys, if they do not
                                                already exist in workspace
      --enable-apis                             Auto enable APIs used by Anthos Bare Metal cluster,
                                                for the GCP Project specified by project-id flag
      --force                                   Overwrite existing config
  -h, --help                                    help for config
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --project-id string                       GCP project where the new cluster will connect with
                                                via GKE hub and stackdriver logging/monitoring,
                                                required if --create-service-accounts or
                                                --enable-apis is true
      --proxy-url string                        Proxy URL for accessing GCP services. If not
                                                specified, bmctl will look for env variable
                                                HTTPS_PROXY and HTTP_PROXY
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

建立 KSA

建立 Kubernetes 服務帳戶,並指派目標叢集的叢集管理員角色。Kubernetes 服務帳戶的預設名稱為 kubernetes-service-account,因此 --name 旗標為選用。 這個指令會產生不記名憑證,可用來登入叢集。根據預設,持有人權杖會儲存在 bmctl-workspace/&lt;cluster_name> 資料夾中。

create ksa [flags]

選項

  -c, --cluster string      Cluster name, cluster config is expected to be placed under
                            <workspace dir>/<cluster name>/<cluster name>.yaml.
  -h, --help                help for ksa
      --ksa-name string     Name of the kubernetes service account and default value is
                            kubernetes-service-account. (default "kubernetes-service-account")
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

停用

在叢集中停用 GDC 的 GVM Runtime。

選項

  -h, --help   help for disable

停用 vmruntime

在叢集中停用 GDC 的 VM Runtime。

disable vmruntime [flags]

選項

      --force               If true, delete all VM resources and disable vmruntime.
  -h, --help                help for vmruntime
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

如要進一步瞭解如何在 GDC 上啟用及停用 VM Runtime,請參閱「在 GDC 上啟用或停用 VM Runtime」。

啟用

在叢集中啟用 GDC 的 VM 執行階段。

選項

  -h, --help   help for enable

啟用 vmruntime

在叢集中啟用 GDC 的 VM 執行階段。

enable vmruntime [flags]

選項

  -h, --help                help for vmruntime
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

如要進一步瞭解如何在 GDC 上啟用及停用 VM Runtime,請參閱「在 GDC 上啟用或停用 VM Runtime」。

get

取得叢集設定或叢集憑證。

選項

  -h, --help   help for get

取得設定

取得叢集設定檔。這項指令會提取目標叢集的自訂資源,並發出設定檔。

get config [flags]

選項

  -c, --cluster string      Cluster name, cluster config is expected to be placed under
                            <workspace dir>/<cluster name>/<cluster name>.yaml.
  -h, --help                help for config
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

詳情請參閱「取得叢集設定詳細資料」。

取得憑證

取得目標叢集憑證。這個指令會在管理員工作站的 <workspace dir>/<cluster name> 資料夾中建立 kubeconfig 檔案。

get credentials [flags]

選項

  -c, --cluster string      Cluster name, cluster config is expected to be placed under
                            <workspace dir>/<cluster name>/<cluster name>.yaml.
  -h, --help                help for credentials
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

詳情請參閱「取得叢集憑證」。

install

執行軟體安裝作業。

選項

  -h, --help   help for install

安裝 virtctl

virtctl 安裝到目前的電腦,做為 kubectl 外掛程式。virtctl 外掛程式支援基本 VM 作業,例如建立、連線及變更電源狀態。

install virtctl [flags]

選項

  -d, --dst-dir string   The dir virtctl binary to be installed, this path must be a valid one within
                          PATH env variable
  -h, --help             help for virtctl

move

在管理叢集之間移動 Google Distributed Cloud 資源和所有依附元件。

  • 目標叢集命名空間可包含其他資源,系統會取代衝突的資源。
move [flags]

選項

      --cluster-move-timeout duration     Cluster move timeout, default value is 15m. The input should
                                          contain the duration unit, e.g. 3600s, 60m or 1h. (default
                                          15m0s)
      --from-kubeconfig string            kubeconfig file path for the source management cluster. If
                                          unspecified, will use the default discovered kubeconfig.
      --from-kubeconfig-context string    Context to be used within the kubeconfig file for the source
                                          management cluster. If empty, current context will be used.
  -h, --help                              help for move
  -n, --namespace string                  The namespace where the cluster resources are stored. If
                                          unspecified, the current context's namespace is used.
      --to-kubeconfig string              kubeconfig file path for the destination management cluster.
      --to-kubeconfig-context string      Context to be used within the kubeconfig file for the
                                          destination management cluster. If empty, current context
                                          will be used.

推送

將 Docker 映像檔推送至私人登錄檔。

選項

  -h, --help   help for push

推送映像檔

將本機容器映像檔 tar 檔案推送至私人登錄檔。

push images [flags]

選項

      --cacert string             Private registry CA certificate file path.
      --dry-run                   Dry run.
      --email string              Email for private registry.
      --force-push                If set to true, will always push images even if images already exist
                                  in registry.
      --format string             Format of images in the source file. Should be one of tarball or oci
                                  (default). (default "oci")
  -h, --help                      help for images
      --need-credential           Whether credential is needed for private registry. (default true)
      --password string           Password for private registry authentication.
  -r, --private-registry string   Private registry path that stores all Anthos Bare Metal images.
                                  Format should be <registry-name>/<optional-registry-namespace>.
      --source string             Path to Anthos Bare Metal container images compressed file.
  -t, --threads int               Push images with multiple threads. (default 4)
      --username string           Username for private registry authentication.

如要瞭解如何為裸機容器映像檔設定及使用登錄檔鏡像,請參閱「為容器映像檔使用登錄檔鏡像」。

register

註冊資源。

選項

  -h, --help   help for register

註冊 bootstrap

向 Hub API 註冊啟動程序叢集。

劇情概要

向 Hub API 註冊啟動程序叢集。這個指令會將本機 Kind 叢集註冊為管理叢集。這項指令會等待叢集在 Google Cloud 控制台中建立,並在叢集建立成功後結束。

register bootstrap [flags]

選項

      --bootstrap-cluster-pod-cidr string               Bootstrap cluster pod CIDR (default
                                                        "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string           Bootstrap cluster service CIDR (default
                                                        "10.96.0.0/27")
      --cloud-operation-service-account-key string      Optional, service account key file used to
                                                        access Google cloud service, service account
                                                        key specified by environment variable
                                                        GOOGLE_APPLICATION_CREDENTIALS will be used to
                                                        fetch or create the Service account.
      --enable-apis                                     Auto enable APIs used by Anthos Bare Metal
                                                        cluster, for the GCP Project specified by
                                                        project-id flag
      --gcr-service-account-key string                  Optional, service account key file used to
                                                        pull Artifact Registry images, service account key
                                                        specified by environment variable
                                                        GOOGLE_APPLICATION_CREDENTIALS will be used to
                                                        fetch or create the Service account.
      --gke-agent-service-account-key string            Optional, service account key file used to
                                                        connect the GKE cluster in Google Cloud,
                                                        service account key specified by environment
                                                        variable GOOGLE_APPLICATION_CREDENTIALS will
                                                        be used to fetch or create the Service
                                                        account.
      --gke-register-service-account-key string         Optional, service account key file used to
                                                        register the cluster in Google Cloud, service
                                                        account key specified by environment variable
                                                        GOOGLE_APPLICATION_CREDENTIALS will be used to
                                                        fetch or create the Service account.
  -h, --help                                            help for bootstrap
      --ignore-validation-errors                        A validation error override, allowing to
                                                        proceed despite the validation errors.
      --location string                                 Optional, Location of the GKEHub Membership,
                                                        e.g. us-central1. If unspecified, global will
                                                        be used. (default "global")
      --name string                                     Mandatory (either --name or
                                                        --target-cluster-name needs to be provided),
                                                        Name of the bootstrap cluster. bmctl will
                                                        register the bootstrap cluster with this name
                                                        with GKE Connect.
      --project-id string                               Optional, GCP project for GKE Connect. bmctl
                                                        will register this bootstrap cluster into GCP
                                                        project temporarily, and un-register it after
                                                        cluster is provisioned successfully.
      --registry-mirror-ca string                       Registry mirror CA file.
      --registry-mirror-credential string               Registry mirror credential file.
      --registry-mirror-endpoint string                 Registry mirror endpoint.
      --reuse-bootstrap-cluster                         If true, use existing bootstrap cluster.
      --ssh-client-cert string                          Optional, Path of the SSH certificate. ABM
                                                        will use this ssh key certificate while sshing
                                                        in the machines.
      --ssh-key string                                  Mandatory, Path of the SSH key. ABM will use
                                                        this ssh key while sshing in the machines.
      --target-cluster-name string                      Optional, The target cluster name.

重設

將叢集機器重設為安裝前的狀態。

劇情概要

這個指令會嘗試復原先前安裝嘗試所做的變更。這項功能會盡可能嘗試修復,目的是從部分安裝失敗的情況中復原。

reset [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for reset
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

重設啟動程序

刪除啟動程序叢集。

reset bootstrap [flags]

範例

bmctl reset bootstrap

選項

  -h, --help   help for bootstrap

重設節點

從叢集中移除節點,將叢集內的指定節點重設為預先安裝的狀態。如果無法存取節點,可以使用 --force 選項略過重設步驟。如果無法存取叢集控制層,可以使用 --ssh-private-key-path--login-user--gcr-service-account-key 選項,將指定節點重設為預先安裝的狀態,而不必從叢集中刪除節點。

reset nodes [flags]

範例

bmctl reset nodes --addresses 10.200.0.10,10.200.0.11 --cluster cluster1 --kubeconfig admin-kubeconfig

選項

      --addresses strings                       Node addresses, addresses should be a comma separated list, each address needs be a single IP address(e.g., 192.168.0.1)
      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed under <workspace dir>/<cluster name>/<cluster name>.yaml
      --force                                   Optional. If provided, nodes will be forcefully removed from the cluster without running reset jobs.
      --gcr-service-account-key string          Optional, path to the service account json key to pull gcr images. Mutually exclusive with --cluster flag. If not provided, the environment variable GOOGLE_APPLICATION_CREDENTIALS will be used.
  -h, --help                                    help for nodes
      --ignore-validation-errors                A validation error override, allowing to proceed despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin cluster. IF not provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.
      --login-user string                       login user to use to connect to the nodes. Mutually exclusive with --cluster flag. Optional and should be used together with --ssh-private-key-path. Default to root.
      --registry-mirror-ca string               Registry mirror CA file.
      --registry-mirror-credential string       Registry mirror credential file.
      --registry-mirror-endpoint string         Registry mirror endpoint.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.
      --ssh-private-key-path string             path to the ssh private key to connect to the nodes. Either --cluster or --ssh-private-key-path should be provided, but not both. Use this flag to reset the machines if the original cluster yaml is no longer available.

如要進一步瞭解如何使用 bmctl reset nodes 將叢集節點還原至安裝前狀態,或刪除叢集,請參閱「在 Google Distributed Cloud 中重設失敗的節點」。

restore

還原叢集或嘗試重新取得叢集的仲裁。

劇情概要

還原叢集。如果未使用叢集子指令,這個指令會嘗試從仲裁損失還原高可用性叢集。與叢集子指令搭配使用時,這個指令會從備份檔案還原叢集。

restore [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be
                                                placed under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
      --control-plane-node string               IP for the surviving host address, should be a
                                                single IP address(e.g., 192.168.0.1).
  -h, --help                                    help for restore
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       kubeconfig file path for the management cluster. This
                                                only needs to be provided if restoring a broken user
                                                cluster.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

還原叢集

從備份檔還原叢集。

restore cluster [flags]

選項

      --backup-file string                      path to the backup file of the cluster.
      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for cluster
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       path to the kubeconfig of the management cluster.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.
      --use-disk                                Perform the restore using the disk instead of
                                                in-memory buffer. This option only works when the
                                                command is run by the root user or with sudo.

如要進一步瞭解如何使用 bmctl 備份及還原叢集,請參閱「使用 bmctl 備份及還原叢集」。

update

更新叢集資源。

選項

  -h, --help   help for update

更新叢集

更新叢集和節點集區設定。這個指令會套用叢集設定檔中所做的變更。根據預設,設定檔 <cluster_name>.yaml 會儲存在管理員工作站的 bmctl-workspace/<cluster_name>/ 資料夾中。

update cluster [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
  -h, --help                                    help for cluster
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.

如要進一步瞭解如何使用 bmctl 更新叢集,請參閱「更新叢集」。如要查看哪些叢集設定檔可變更,請參閱叢集設定欄位參考資料

更新憑證

更新叢集憑證。

劇情概要

更新叢集的憑證。這個指令會更新管理員叢集憑證,以及由管理員叢集管理的憑證。

update credentials [flags]

選項

      --bootstrap-cluster-pod-cidr string                     Bootstrap cluster pod CIDR (default
                                                              "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string                 Bootstrap cluster service CIDR (default
                                                              "10.96.0.0/27")
      --cloud-operations-service-account-key-path string      New credential: path to cloud operations
                                                              service account  key.
  -c, --cluster cluster name                                  Cluster name, cluster config is expected
                                                              to be placed under
                                                              <workspace dir>/<cluster name>/<cluster name>.yaml
      --gcr-key-path string                                   New credential: path to GCR service
                                                              account key.
      --gke-connect-agent-service-account-key-path string     New credential: path to gke connect
                                                              agent service account key.
      --gke-connect-register-service-account-key-path string  New credential: path to gke connect
                                                              register service account key.
  -h, --help                                                  help for credentials
      --ignore-validation-errors                              A validation error override, allowing
                                                              to proceed despite the validation errors.
      --kubeconfig string                                     Optional, path to the kubeconfig file
                                                              for the admin cluster. IF not provided,
                                                              will fall back to read env var
                                                              ANTHOS_ADMIN_KUBECONFIG.
      --node-agent-client-cert-path string                    New credential: path to Node Agent
                                                              client certificates.
      --node-agent-client-private-key-path string             New credential: path to Node Agent
                                                              client private key.
      --node-agent-server-ca-path string                      New credential: path to Node Agent
                                                              server CA.
      --reuse-bootstrap-cluster                               If true, use existing bootstrap cluster.
      --ssh-private-key-path string                           New credential: path to ssh private key.

update credentials certificate-authorities

更新叢集中的憑證授權單位。

選項

  -h, --help   help for certificate-authorities

從父項指令繼承的選項

      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

update credentials certificate-authorities rotate

輪替憑證授權單位。

update credentials certificate-authorities rotate [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
      --cluster-ca-cert-path string             New credential: path to custom cluster CA certificate.
      --cluster-ca-private-key-path string      New credential: path to custom cluster CA private key.
      --etcd-ca-cert-path string                New credential: path to custom etcd CA certificate.
      --etcd-ca-private-key-path string         New credential: path to custom etcd CA private key.
      --front-proxy-ca-cert-path string         New credential: path to custom front proxy CA
                                                certificate.
      --front-proxy-ca-private-key-path string  New credential: path to custom front proxy CA private
                                                key.
  -h, --help                                    help for rotate
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.
````

#### Options inherited from parent commands

```none
      --kubeconfig string   Optional, path to the kubeconfig file for the admin cluster. IF not
                            provided, will fall back to read env var ANTHOS_ADMIN_KUBECONFIG.

升級

將叢集就地升級至新版本。

選項

  -h, --help   help for upgrade

升級叢集

升級叢集。

劇情概要

升級叢集。這項指令會從叢集設定檔讀取目標版本,並將目標叢集升級至指定版本。系統會忽略叢集設定檔中的所有其他變更。這項指令需要 serviceusage.services.get 權限,才能檢查設定檔中指定的 Google Cloud 專案是否已啟用 API。

upgrade cluster [flags]

選項

      --bootstrap-cluster-pod-cidr string       Bootstrap cluster pod CIDR (default
                                                "192.168.122.0/24")
      --bootstrap-cluster-service-cidr string   Bootstrap cluster service CIDR (default
                                                "10.96.0.0/27")
  -c, --cluster cluster name                    Cluster name, cluster config is expected to be placed
                                                under
                                                <workspace dir>/<cluster name>/<cluster name>.yaml
      --cluster-update-timeout duration         Cluster update timeout, default value is 24h. The
                                                input should contain the duration unit, e.g. 3600s,
                                                60m or 1h. (default 24h0m0s)
      --force                                   If true, ignore errors from preflight checks.
  -h, --help                                    help for cluster
      --ignore-validation-errors                A validation error override, allowing to proceed
                                                despite the validation errors.
      --kubeconfig string                       Optional, path to the kubeconfig file for the admin
                                                cluster. IF not provided, will fall back to read env
                                                var ANTHOS_ADMIN_KUBECONFIG.
      --reuse-bootstrap-cluster                 If true, use existing bootstrap cluster.
      --skip-bootstrap-cidr-check               If true, skip checking CIDR and the number of nodes
                                                to determine whether upgrade would succeed.
      --skip-preflight                          If true, skip standalone preflight checks.

如要進一步瞭解叢集升級,請參閱下列說明文件:

version

列印 bmctl

version [flags]

選項

  -h, --help            help for version
  -o, --output string   Output format of version string. Supported options: [version, commit,
                        metadata-digest]