UpdateClusterVersion 搭配 AWS SDK或 使用 CLI - AWS SDK 程式碼範例

文件範例儲存庫中有更多 AWS SDK可用的範例。 AWS SDK GitHub

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

UpdateClusterVersion 搭配 AWS SDK或 使用 CLI

下列程式碼範例示範如何使用 UpdateClusterVersion

CLI
AWS CLI

將名為 `my-eks-cluster` 的 Amazon EKS叢集更新為指定的 Kubernetes 版本

下列update-cluster-version範例會將 Amazon EKS叢集更新為指定的 Kubernetes 版本。

aws eks update-cluster-version \ --name my-eks-cluster \ --kubernetes-version 1.27

輸出:

{ "update": { "id": "e4091a28-ea14-48fd-a8c7-975aeb469e8a", "status": "InProgress", "type": "VersionUpdate", "params": [ { "type": "Version", "value": "1.27" }, { "type": "PlatformVersion", "value": "eks.16" } ], "createdAt": "2024-04-12T16:56:01.082000-04:00", "errors": [] } }

如需詳細資訊,請參閱 Amazon 使用者指南 中的更新 Amazon EKS叢集 Kubernetes 版本 EKS

PowerShell
適用於 的工具 PowerShell

範例 1:此 cmdlet 會將 Amazon EKS叢集更新為指定的 Kubernetes 版本。您的叢集會在更新期間繼續運作。

Update-EKSClusterVersion -Name "PROD-KUBE-CL" -Version 1.14

輸出:

CreatedAt : 12/26/2019 9:50:37 AM Errors : {} Id : ef186eff-3b3a-4c25-bcfc-3dcdf9e898a8 Params : {Amazon.EKS.Model.UpdateParam, Amazon.EKS.Model.UpdateParam} Status : InProgress Type : VersionUpdate
  • 如需API詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考 UpdateClusterVersion中的 。