az aks maintenanceconfiguration

注意

此命令群組具有 Azure CLI 和至少一個擴充功能中定義的命令。 安裝每個擴充功能以受益于其擴充功能。 深入了解擴充功能。

管理受控 Kubernetes 叢集中維護設定的命令。

命令

名稱 Description 類型 狀態
az aks maintenanceconfiguration add

在受控 Kubernetes 叢集中新增維護組態。

核心 GA
az aks maintenanceconfiguration add (aks-preview 擴充功能)

在受控 Kubernetes 叢集中新增維護組態。

擴充 GA
az aks maintenanceconfiguration delete

刪除受控 Kubernetes 叢集中的維護設定。

核心 GA
az aks maintenanceconfiguration delete (aks-preview 擴充功能)

刪除受控 Kubernetes 叢集中的維護設定。

擴充 GA
az aks maintenanceconfiguration list

列出受控 Kubernetes 叢集中的維護組態。

核心 GA
az aks maintenanceconfiguration list (aks-preview 擴充功能)

列出受控 Kubernetes 叢集中的維護組態。

擴充 GA
az aks maintenanceconfiguration show

顯示受控 Kubernetes 叢集中維護設定的詳細資料。

核心 GA
az aks maintenanceconfiguration show (aks-preview 擴充功能)

顯示受控 Kubernetes 叢集中維護設定的詳細資料。

擴充 GA
az aks maintenanceconfiguration update

更新受控 Kubernetes 叢集的維護設定。

核心 GA
az aks maintenanceconfiguration update (aks-preview 擴充功能)

更新受控 Kubernetes 叢集的維護設定。

擴充 GA

az aks maintenanceconfiguration add

在受控 Kubernetes 叢集中新增維護組態。

az aks maintenanceconfiguration add --cluster-name
                                    --name
                                    --resource-group
                                    [--config-file]
                                    [--day-of-month]
                                    [--day-of-week]
                                    [--duration]
                                    [--interval-days]
                                    [--interval-months]
                                    [--interval-weeks]
                                    [--schedule-type {AbsoluteMonthly, Daily, RelativeMonthly, Weekly}]
                                    [--start-date]
                                    [--start-hour]
                                    [--start-time]
                                    [--utc-offset]
                                    [--week-index {First, Fourth, Last, Second, Third}]
                                    [--weekday]

範例

使用 --weekday 和 --start-hour 新增預設維護組態。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --weekday Monday  --start-hour 1
  The maintenance is allowed on Monday 1:00am to 2:00am

使用 --weekday 新增預設維護組態。 當天的任何時間都允許維護。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --weekday Monday
  The maintenance is allowed on Monday.

使用維護組態 json 檔案新增預設維護組態

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on UTC time Tuesday 1:00am - 3:00 am and Wednesday 1:00am - 2:00am, 6:00am-7:00am
    No maintenance is allowed from 2020-11-26T03:00:00Z to 2020-11-30T12:00:00Z and from 2020-12-26T03:00:00Z to 2020-12-26T12:00:00Z even if they are allowed in the above weekly setting
    {
          "timeInWeek": [
            {
              "day": "Tuesday",
              "hourSlots": [
                1,
                2
              ]
            },
            {
              "day": "Wednesday",
              "hourSlots": [
                1,
                6
              ]
            }
          ],
          "notAllowedTime": [
            {
              "start": "2021-11-26T03:00:00Z",
              "end": "2021-11-30T12:00:00Z"
            },
            {
              "start": "2021-12-26T03:00:00Z",
              "end": "2021-12-26T12:00:00Z"
            }
          ]
  }

使用每日排程新增 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
  The maintenance is allowed from 00:00 to 12:00 (adjusted with UTC offset: -08:00) every two days, and this configuration will be effective from 2023-01-16.

使用每週排程新增 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Weekly --day-of-week Friday --interval-weeks 3 --duration 8 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on Friday from 09:30 to 17:30 (adjusted with UTC offset: +05:30) every three weeks, and this configuration will be effective from 2023-01-16.

使用絕對每月排程新增 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type AbsoluteMonthly --day-of-month 15 --interval-months 1 --duration 6 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the 15th of the month from 09:30 to 15:30 (adjusted with UTC offset: +05:30) every month, and this configuration will be effective from 2023-01-16.

使用相對每月排程新增 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type RelativeMonthly --day-of-week Tuesday --week-index Last --interval-months 3 --duration 6 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the last Tuesday from 09:30 to 15:30 in default UTC time every 3 months, and this configuration will be effective from 2023-01-16.

使用 json 檔案新增 aksManagedAutoUpgradeSchedule 維護組態。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on the 1st of the month from 09:00 to 13:00 (adjusted with UTC offset: -08:00) every 3 months, and this configuration will be effective from 2023-01-16.
    No maintenance is allowed from 2022-12-23 to 2023-01-05 and from 2023-11-23 to 2023-11-26 even if they are allowed in the above monthly setting
    {
        "maintenanceWindow": {
            "schedule": {
                "absoluteMonthly": {
                    "intervalMonths": 3,
                    "dayOfMonth": 1
                }
            },
            "durationHours": 4,
            "utcOffset": "-08:00",
            "startTime": "09:00",
            "notAllowedDates": [
                {
                    "start": "2022-12-23",
                    "end": "2023-01-05"
                },
                {
                    "start": "2023-11-23",
                    "end": "2023-11-26"
                }
            ]
        }
    }

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--config-file

維護組態 json 檔案。

--day-of-month

指定維護髮生當月哪一天。 例如 1 表示月份的第 1 個。 僅適用于絕對每月排程類型。

--day-of-week

指定發生維護的一周哪一天。 例如「星期一」。 適用于每週和相對每月排程類型。

--duration

維護時段的長度從 4 小時到 24 小時不等。

--interval-days

每日排程類型的每組發生次數之間的天數。

--interval-months

每組發生次數之間的月數。 適用于絕對和相對每月排程類型。

--interval-weeks

每組發生次數之間的周數。 僅適用于每週排程類型。

--schedule-type

為您的維護排程選擇 [每日]、[每週]、[絕對月刊] 或 [RelativeMonthly]。 僅適用于 'aksManagedAutoUpgradeSchedule' 和 'aksManagedNodeOSUpgradeSchedule' 維護組態。

接受的值: AbsoluteMonthly, Daily, RelativeMonthly, Weekly
--start-date

維護組態啟動的日期。 如果未指定,維護期間將會立即處於作用中狀態。」。

--start-hour

允許維護的 1 小時時段開始時間。 例如 1 表示允許在上午 1:00 到上午 2:00 之間。 僅適用于預設維護組態。

--start-time

維護時段的開始時間。 接受的值是從 '00:00' 到 '23:59'。 '--utc-offset' 適用于此欄位。 例如,'02:00' 與 '--utc-offset +02:00' 表示 UTC 時間 '00:00'。

--utc-offset

格式為 +/-HH:mm 的 UTC 位移。 例如,IST 的 '+05:30' 和 PST 的 '-07:00' 。 如果未指定,則預設值為 '+00:00'。

--week-index

指定維護髮生於 '---day-of-week' 中所指定允許天數的實例。 僅適用于相對每月排程類型。

接受的值: First, Fourth, Last, Second, Third
--weekday

允許維護的一週一天。 例如星期一 僅適用于預設維護組態。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration add (aks-preview 擴充功能)

在受控 Kubernetes 叢集中新增維護組態。

az aks maintenanceconfiguration add --cluster-name
                                    --name
                                    --resource-group
                                    [--config-file]
                                    [--day-of-month]
                                    [--day-of-week]
                                    [--duration]
                                    [--interval-days]
                                    [--interval-months]
                                    [--interval-weeks]
                                    [--schedule-type {AbsoluteMonthly, Daily, RelativeMonthly, Weekly}]
                                    [--start-date]
                                    [--start-hour]
                                    [--start-time]
                                    [--utc-offset]
                                    [--week-index {First, Fourth, Last, Second, Third}]
                                    [--weekday]

範例

使用 --weekday 和 --start-hour 新增預設維護組態。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --weekday Monday  --start-hour 1
  The maintenance is allowed on Monday 1:00am to 2:00am

使用 --weekday 新增預設維護組態。 當天的任何時間都允許維護。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --weekday Monday
  The maintenance is allowed on Monday.

使用維護組態 json 檔案新增預設維護組態

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on UTC time Tuesday 1:00am - 3:00 am and Wednesday 1:00am - 2:00am, 6:00am-7:00am
    No maintenance is allowed from 2020-11-26T03:00:00Z to 2020-11-30T12:00:00Z and from 2020-12-26T03:00:00Z to 2020-12-26T12:00:00Z even if they are allowed in the above weekly setting
    {
          "timeInWeek": [
            {
              "day": "Tuesday",
              "hourSlots": [
                1,
                2
              ]
            },
            {
              "day": "Wednesday",
              "hourSlots": [
                1,
                6
              ]
            }
          ],
          "notAllowedTime": [
            {
              "start": "2021-11-26T03:00:00Z",
              "end": "2021-11-30T12:00:00Z"
            },
            {
              "start": "2021-12-26T03:00:00Z",
              "end": "2021-12-26T12:00:00Z"
            }
          ]
  }

使用每日排程新增 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
  The maintenance is allowed from 00:00 to 12:00 (adjusted with UTC offset: -08:00) every two days, and this configuration will be effective from 2023-01-16.

使用每週排程新增 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Weekly --day-of-week Friday --interval-weeks 3 --duration 8 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on Friday from 09:30 to 17:30 (adjusted with UTC offset: +05:30) every three weeks, and this configuration will be effective from 2023-01-16.

使用絕對每月排程新增 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type AbsoluteMonthly --day-of-month 15 --interval-months 1 --duration 6 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the 15th of the month from 09:30 to 15:30 (adjusted with UTC offset: +05:30) every month, and this configuration will be effective from 2023-01-16.

使用相對每月排程新增 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type RelativeMonthly --day-of-week Tuesday --week-index Last --interval-months 3 --duration 6 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the last Tuesday from 09:30 to 15:30 in default UTC time every 3 months, and this configuration will be effective from 2023-01-16.

使用 json 檔案新增 aksManagedAutoUpgradeSchedule 維護組態。

az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on the 1st of the month from 09:00 to 13:00 (adjusted with UTC offset: -08:00) every 3 months, and this configuration will be effective from 2023-01-16.
    No maintenance is allowed from 2022-12-23 to 2023-01-05 and from 2023-11-23 to 2023-11-26 even if they are allowed in the above monthly setting
    {
        "maintenanceWindow": {
            "schedule": {
                "absoluteMonthly": {
                    "intervalMonths": 3,
                    "dayOfMonth": 1
                }
            },
            "durationHours": 4,
            "utcOffset": "-08:00",
            "startTime": "09:00",
            "notAllowedDates": [
                {
                    "start": "2022-12-23",
                    "end": "2023-01-05"
                },
                {
                    "start": "2023-11-23",
                    "end": "2023-11-26"
                }
            ]
        }
    }

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--config-file

維護組態 json 檔案。

--day-of-month

指定維護髮生當月哪一天。 例如 1 表示月份的第 1 個。 僅適用于絕對每月排程類型。

--day-of-week

指定發生維護的一周哪一天。 例如「星期一」。 適用于每週和相對每月排程類型。

--duration

維護時段的長度從 4 小時到 24 小時不等。

--interval-days

每日排程類型的每組發生次數之間的天數。

--interval-months

每組發生次數之間的月數。 適用于絕對和相對每月排程類型。

--interval-weeks

每組發生次數之間的周數。 僅適用于每週排程類型。

--schedule-type

為您的維護排程選擇 [每日]、[每週]、[絕對月刊] 或 [RelativeMonthly]。 僅適用于 'aksManagedAutoUpgradeSchedule' 和 'aksManagedNodeOSUpgradeSchedule' 維護組態。

接受的值: AbsoluteMonthly, Daily, RelativeMonthly, Weekly
--start-date

維護組態啟動的日期。 如果未指定,維護期間將會立即處於作用中狀態。」。

--start-hour

允許維護的 1 小時時段開始時間。 例如 1 表示允許在上午 1:00 到上午 2:00 之間。 僅適用于預設維護組態。

--start-time

維護時段的開始時間。 接受的值是從 '00:00' 到 '23:59'。 '--utc-offset' 適用于此欄位。 例如,'02:00' 與 '--utc-offset +02:00' 表示 UTC 時間 '00:00'。

--utc-offset

格式為 +/-HH:mm 的 UTC 位移。 例如,IST 的 '+05:30' 和 PST 的 '-07:00' 。 如果未指定,則預設值為 '+00:00'。

--week-index

指定維護髮生於 '---day-of-week' 中所指定允許天數的實例。 僅適用于相對每月排程類型。

接受的值: First, Fourth, Last, Second, Third
--weekday

允許維護的一週一天。 例如星期一 僅適用于預設維護組態。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration delete

刪除受控 Kubernetes 叢集中的維護設定。

az aks maintenanceconfiguration delete --cluster-name
                                       --name
                                       --resource-group

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration delete (aks-preview 擴充功能)

刪除受控 Kubernetes 叢集中的維護設定。

az aks maintenanceconfiguration delete --cluster-name
                                       --name
                                       --resource-group

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration list

列出受控 Kubernetes 叢集中的維護組態。

az aks maintenanceconfiguration list --cluster-name
                                     --resource-group

必要參數

--cluster-name

叢集名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration list (aks-preview 擴充功能)

列出受控 Kubernetes 叢集中的維護組態。

az aks maintenanceconfiguration list --cluster-name
                                     --resource-group

必要參數

--cluster-name

叢集名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration show

顯示受控 Kubernetes 叢集中維護設定的詳細資料。

az aks maintenanceconfiguration show --cluster-name
                                     --name
                                     --resource-group

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration show (aks-preview 擴充功能)

顯示受控 Kubernetes 叢集中維護設定的詳細資料。

az aks maintenanceconfiguration show --cluster-name
                                     --name
                                     --resource-group

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration update

更新受控 Kubernetes 叢集的維護設定。

az aks maintenanceconfiguration update --cluster-name
                                       --name
                                       --resource-group
                                       [--config-file]
                                       [--day-of-month]
                                       [--day-of-week]
                                       [--duration]
                                       [--interval-days]
                                       [--interval-months]
                                       [--interval-weeks]
                                       [--schedule-type {AbsoluteMonthly, Daily, RelativeMonthly, Weekly}]
                                       [--start-date]
                                       [--start-hour]
                                       [--start-time]
                                       [--utc-offset]
                                       [--week-index {First, Fourth, Last, Second, Third}]
                                       [--weekday]

範例

使用 --weekday 和 --start-hour 更新預設維護組態。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --weekday Monday  --start-hour 1
  The maintenance is allowed on Monday 1:00am to 2:00am

使用 --weekday 更新預設維護組態。當天的任何時間都允許維護。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --weekday Monday
  The maintenance is allowed on Monday.

使用維護組態 json 檔案更新預設維護組態

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on UTC time Tuesday 1:00am - 3:00 am and Wednesday 1:00am - 2:00am, 6:00am-7:00am
    No maintenance is allowed from 2020-11-26T03:00:00Z to 2020-11-30T12:00:00Z and from 2020-12-26T03:00:00Z to 2020-12-26T12:00:00Z even if they are allowed in the above weekly setting
    {
          "timeInWeek": [
            {
              "day": "Tuesday",
              "hourSlots": [
                1,
                2
              ]
            },
            {
              "day": "Wednesday",
              "hourSlots": [
                1,
                6
              ]
            }
          ],
          "notAllowedTime": [
            {
              "start": "2021-11-26T03:00:00Z",
              "end": "2021-11-30T12:00:00Z"
            },
            {
              "start": "2021-12-26T03:00:00Z",
              "end": "2021-12-26T12:00:00Z"
            }
          ]
  }

使用每日排程更新 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
  The maintenance is allowed from 00:00 to 12:00 (adjusted with UTC offset: -08:00) every two days. This configuration will be effective from 2023-01-16.

使用每週排程更新 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Weekly --day-of-week Friday --interval-weeks 3 --duration 8 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on Friday from 09:30 to 17:30 (adjusted with UTC offset: +05:30) every three weeks. This configuration will be effective from 2023-01-16.

使用絕對每月排程更新 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type AbsoluteMonthly --day-of-month 15 --interval-months 1 --duration 6 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the 15th of the month from 09:30 to 15:30 (adjusted with UTC offset: +05:30) every month. This configuration will be effective from 2023-01-16.

使用相對每月排程更新 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type RelativeMonthly --day-of-week Tuesday --week-index Last --interval-months 3 --duration 6 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the last Tuesday from 09:30 to 15:30 in default UTC time every 3 months. This configuration will be effective from 2023-01-16.

使用 json 檔案更新 aksManagedAutoUpgradeSchedule 維護組態。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on the 1st of the month from 09:00 to 13:00 (adjusted with UTC offset: -08:00) every 3 months, and this configuration will be effective from 2023-01-16.
    No maintenance is allowed from 2022-12-23 to 2023-01-05 and from 2023-11-23 to 2023-11-26 even if they are allowed in the above monthly setting
    {
        "maintenanceWindow": {
            "schedule": {
                "absoluteMonthly": {
                    "intervalMonths": 3,
                    "dayOfMonth": 1
                }
            },
            "durationHours": 4,
            "utcOffset": "-08:00",
            "startTime": "09:00",
            "notAllowedDates": [
                {
                    "start": "2022-12-23",
                    "end": "2023-01-05"
                },
                {
                    "start": "2023-11-23",
                    "end": "2023-11-26"
                }
            ]
        }
    }

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--config-file

維護組態 json 檔案。

--day-of-month

指定維護髮生當月哪一天。 例如 1 表示月份的第 1 個。 僅適用于絕對每月排程類型。

--day-of-week

指定發生維護的一周哪一天。 例如「星期一」。 適用于每週和相對每月排程類型。

--duration

維護時段的長度從 4 小時到 24 小時不等。

--interval-days

每日排程類型的每組發生次數之間的天數。

--interval-months

每組發生次數之間的月數。 適用于絕對和相對每月排程類型。

--interval-weeks

每組發生次數之間的周數。 僅適用于每週排程類型。

--schedule-type

為您的維護排程選擇 [每日]、[每週]、[絕對月刊] 或 [RelativeMonthly]。 僅適用于 'aksManagedAutoUpgradeSchedule' 和 'aksManagedNodeOSUpgradeSchedule' 維護組態。

接受的值: AbsoluteMonthly, Daily, RelativeMonthly, Weekly
--start-date

維護組態啟動的日期。 如果未指定,維護期間將會立即處於作用中狀態。」。

--start-hour

允許維護的 1 小時時段開始時間。 例如 1 表示允許在上午 1:00 到上午 2:00 之間。 僅適用于預設維護組態。

--start-time

維護時段的開始時間。 接受的值是從 '00:00' 到 '23:59'。 '--utc-offset' 適用于此欄位。 例如,'02:00' 與 '--utc-offset +02:00' 表示 UTC 時間 '00:00'。

--utc-offset

格式為 +/-HH:mm 的 UTC 位移。 例如,IST 的 '+05:30' 和 PST 的 '-07:00' 。 如果未指定,則預設值為 '+00:00'。

--week-index

指定維護髮生於 '---day-of-week' 中所指定允許天數的實例。 僅適用于相對每月排程類型。

接受的值: First, Fourth, Last, Second, Third
--weekday

允許維護的一週一天。 例如星期一 僅適用于預設維護組態。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az aks maintenanceconfiguration update (aks-preview 擴充功能)

更新受控 Kubernetes 叢集的維護設定。

az aks maintenanceconfiguration update --cluster-name
                                       --name
                                       --resource-group
                                       [--config-file]
                                       [--day-of-month]
                                       [--day-of-week]
                                       [--duration]
                                       [--interval-days]
                                       [--interval-months]
                                       [--interval-weeks]
                                       [--schedule-type {AbsoluteMonthly, Daily, RelativeMonthly, Weekly}]
                                       [--start-date]
                                       [--start-hour]
                                       [--start-time]
                                       [--utc-offset]
                                       [--week-index {First, Fourth, Last, Second, Third}]
                                       [--weekday]

範例

使用 --weekday 和 --start-hour 更新預設維護組態。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --weekday Monday  --start-hour 1
  The maintenance is allowed on Monday 1:00am to 2:00am

使用 --weekday 更新預設維護組態。當天的任何時間都允許維護。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --weekday Monday
  The maintenance is allowed on Monday.

使用維護組態 json 檔案更新預設維護組態

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on UTC time Tuesday 1:00am - 3:00 am and Wednesday 1:00am - 2:00am, 6:00am-7:00am
    No maintenance is allowed from 2020-11-26T03:00:00Z to 2020-11-30T12:00:00Z and from 2020-12-26T03:00:00Z to 2020-12-26T12:00:00Z even if they are allowed in the above weekly setting
    {
          "timeInWeek": [
            {
              "day": "Tuesday",
              "hourSlots": [
                1,
                2
              ]
            },
            {
              "day": "Wednesday",
              "hourSlots": [
                1,
                6
              ]
            }
          ],
          "notAllowedTime": [
            {
              "start": "2021-11-26T03:00:00Z",
              "end": "2021-11-30T12:00:00Z"
            },
            {
              "start": "2021-12-26T03:00:00Z",
              "end": "2021-12-26T12:00:00Z"
            }
          ]
  }

使用每日排程更新 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
  The maintenance is allowed from 00:00 to 12:00 (adjusted with UTC offset: -08:00) every two days. This configuration will be effective from 2023-01-16.

使用每週排程更新 aksManagedNodeOSUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Weekly --day-of-week Friday --interval-weeks 3 --duration 8 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on Friday from 09:30 to 17:30 (adjusted with UTC offset: +05:30) every three weeks. This configuration will be effective from 2023-01-16.

使用絕對每月排程更新 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type AbsoluteMonthly --day-of-month 15 --interval-months 1 --duration 6 --utc-offset +05:30 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the 15th of the month from 09:30 to 15:30 (adjusted with UTC offset: +05:30) every month. This configuration will be effective from 2023-01-16.

使用相對每月排程更新 aksManagedAutoUpgradeSchedule 維護設定。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --schedule-type RelativeMonthly --day-of-week Tuesday --week-index Last --interval-months 3 --duration 6 --start-date 2023-01-16 --start-time 09:30
  The maintenance is allowed on the last Tuesday from 09:30 to 15:30 in default UTC time every 3 months. This configuration will be effective from 2023-01-16.

使用 json 檔案更新 aksManagedAutoUpgradeSchedule 維護組態。

az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedAutoUpgradeSchedule --config-file ./test.json
    The content of json file looks below. It means the maintenance is allowed on the 1st of the month from 09:00 to 13:00 (adjusted with UTC offset: -08:00) every 3 months, and this configuration will be effective from 2023-01-16.
    No maintenance is allowed from 2022-12-23 to 2023-01-05 and from 2023-11-23 to 2023-11-26 even if they are allowed in the above monthly setting
    {
        "maintenanceWindow": {
            "schedule": {
                "absoluteMonthly": {
                    "intervalMonths": 3,
                    "dayOfMonth": 1
                }
            },
            "durationHours": 4,
            "utcOffset": "-08:00",
            "startTime": "09:00",
            "notAllowedDates": [
                {
                    "start": "2022-12-23",
                    "end": "2023-01-05"
                },
                {
                    "start": "2023-11-23",
                    "end": "2023-11-26"
                }
            ]
        }
    }

必要參數

--cluster-name

叢集名稱。

--name -n

組態名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--config-file

維護組態 json 檔案。

--day-of-month

指定維護髮生當月哪一天。 例如 1 表示月份的第 1 個。 僅適用于絕對每月排程類型。

--day-of-week

指定發生維護的一周哪一天。 例如「星期一」。 適用于每週和相對每月排程類型。

--duration

維護時段的長度從 4 小時到 24 小時不等。

--interval-days

每日排程類型的每組發生次數之間的天數。

--interval-months

每組發生次數之間的月數。 適用于絕對和相對每月排程類型。

--interval-weeks

每組發生次數之間的周數。 僅適用于每週排程類型。

--schedule-type

為您的維護排程選擇 [每日]、[每週]、[絕對月刊] 或 [RelativeMonthly]。 僅適用于 'aksManagedAutoUpgradeSchedule' 和 'aksManagedNodeOSUpgradeSchedule' 維護組態。

接受的值: AbsoluteMonthly, Daily, RelativeMonthly, Weekly
--start-date

維護組態啟動的日期。 如果未指定,維護期間將會立即處於作用中狀態。」。

--start-hour

允許維護的 1 小時時段開始時間。 例如 1 表示允許在上午 1:00 到上午 2:00 之間。 僅適用于預設維護組態。

--start-time

維護時段的開始時間。 接受的值是從 '00:00' 到 '23:59'。 '--utc-offset' 適用于此欄位。 例如,'02:00' 與 '--utc-offset +02:00' 表示 UTC 時間 '00:00'。

--utc-offset

格式為 +/-HH:mm 的 UTC 位移。 例如,IST 的 '+05:30' 和 PST 的 '-07:00' 。 如果未指定,則預設值為 '+00:00'。

--week-index

指定維護髮生於 '---day-of-week' 中所指定允許天數的實例。 僅適用于相對每月排程類型。

接受的值: First, Fourth, Last, Second, Third
--weekday

允許維護的一週一天。 例如星期一 僅適用于預設維護組態。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。