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

AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例

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

UpdateClusterConfig配 AWS SDK或使用 CLI

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

CLI
AWS CLI

更新叢集端點存取

此範例命令會更新叢集,以停用端點公開存取並啟用私有端點存取。

命令:

aws eks update-cluster-config --name example \ --resources-vpc-config endpointPublicAccess=false,endpointPrivateAccess=true

輸出:

{ "update": { "id": "ec883c93-2e9e-407c-a22f-8f6fa6e67d4f", "status": "InProgress", "type": "EndpointAccessUpdate", "params": [ { "type": "EndpointPublicAccess", "value": "false" }, { "type": "EndpointPrivateAccess", "value": "true" } ], "createdAt": 1565806986.506, "errors": [] } }

啟用叢集的記錄功能

此範例命令會啟用名為的叢集的所有叢集控制平面記錄類型example

命令:

aws eks update-cluster-config --name example \ --logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'

輸出:

{ "update": { "id": "7551c64b-1d27-4b1e-9f8e-c45f056eb6fd", "status": "InProgress", "type": "LoggingUpdate", "params": [ { "type": "ClusterLogging", "value": "{\"clusterLogging\":[{\"types\":[\"api\",\"audit\",\"authenticator\",\"controllerManager\",\"scheduler\"],\"enabled\":true}]}" } ], "createdAt": 1565807210.37, "errors": [] } }
PowerShell
適用的工具 PowerShell

範例 1:更新 Amazon EKS 叢集組態。您的叢集會在更新期間繼續運作。

Update-EKSClusterConfig -Name "PROD" -Logging_ClusterLogging @{Types="api","audit","authenticator","controllerManager","scheduler",Enabled="True"}

輸出:

CreatedAt : 12/25/2019 5:03:07 PM Errors : {} Id : ee708232-7d2e-4ed7-9270-d0b5176f0726 Params : {Amazon.EKS.Model.UpdateParam} Status : InProgress Type : LoggingUpdate
  • 如需詳API細資訊,請參閱AWS Tools for PowerShell 指令程UpdateClusterConfig式參考中的。