cloud-barista / cb-spider

CB-Spider offers a unified view and interface for multi-cloud management.
https://github.com/cloud-barista/cb-spider/wiki
Apache License 2.0
31 stars 47 forks source link

[Azure:PMKS] When availability zone is not supported(WestUS region), it failed to create a kubernetes cluster #1246

Closed sykim-etri closed 4 weeks ago

sykim-etri commented 1 month ago

Azure를 대상으로 PMKS 시험 진행 중 WestUS 리전의 경우 아래와 같은 에러를 리턴하고 있습니다. 다른 리전과는 달리 제공하는 쿠버네티스 버전도 다르고 콘솔 상에서도 recommended 리전으로 활성화되진 않으나, 콘솔 상에서는 클러스터가 생성이 되긴 합니다. 혹시 관련하여 알고 계신 사항이 있으실까요? @ish-hcc

[CB-SPIDER].[ERROR]: 2024-07-18 16:25:05 ClusterManager.go:486, github.com/cloud-barista/cb-spider/api-runtime/common-runtime.CreateCluster() - Failed to Create Cluster. err = containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="AvailabilityZoneNotSupported" Message="Availability zone is not supported in region westus." Target="agentPoolProfile.availabilityZone" 
sykim-etri commented 1 month ago

northcentralus 리전도 동일한 에러를 리턴합니다. 콘솔 시험은 진행해보진 않았습니다.

sykim-etri commented 1 month ago

japanwest 리전은 조금 다른 에러(유사 원인?)를 리턴합니다. 콘솔을 통해서는 생성이 가능합니다.

[CB-SPIDER].[ERROR]: 2024-07-19 15:21:45 ClusterManager.go:486, github.com/cloud-barista/cb-spider/api-runtime/common-runtime.CreateCluster() - Failed to Create Cluster. err = containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="PreconditionFailed" Message="Preflight validation check for resource(s) for container service ns01-tb111-cqd0bskcpuqd2mj97m80 in resource group CB_japanwest_ns01-tb111-cqd0bskcpuqd2mj97m80_japanwest failed. Message: The template deployment failed with error: 'The resource with id: '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourceGroups/CB_japanwest_ns01-tb111-cqd0bskcpuqd2mj97m80_japanwest/providers/Microsoft.Compute/virtualMachineScaleSets/aks-ng11-25820110-vmss' failed validation with message: 'The resource 'Microsoft.Compute/virtualMachineScaleSets/aks-ng11-25820110-vmss' does not support availability zones at location 'japanwest'.'.'.. Details: [{\"code\":\"\",\"message\":\"The resource with id: '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourceGroups/CB_japanwest_ns01-tb111-cqd0bskcpuqd2mj97m80_japanwest/providers/Microsoft.Compute/virtualMachineScaleSets/aks-ng11-25820110-vmss' failed validation with message: 'The resource 'Microsoft.Compute/virtualMachineScaleSets/aks-ng11-25820110-vmss' does not support availability zones at location 'japanwest'.'.\"}]" 
sykim-etri commented 1 month ago

유사 에러가 발생하는 리전을 정리하면 다음과 같습니다. 일부 리전에 대해 콘솔을 통한 클러스터 생성은 정상적으로 진행되었으며, 아래 리전 대부분은 콘솔에서 정상적으로 생성이 가능할 것으로 판단됩니다.

다만 southindia의 경우 콘솔에서 생성시 이름 중복 이슈가 생겨 클러스터 생성이 실패하였는데, 자동 생성된 이름인데 동일한 경우가 있기에 대처가 쉽지 않아 보입니다.

{
  "error": {
    "code": "InvalidTemplateDeployment",
    "details": [
      {
        "code": "TemplateDeploymentValidationFailed",
        "message": "Validation failed for 'Microsoft.Dashboard/grafana'.",
        "details": [
          {
            "code": "DuplicatedSimilarAzureMonitorWorkspace",
            "message": "Due to technical limitations, integrations with multiple Azure Monitor Workspace of the same resource name is not supported. These two are having conflicting resource name: '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourcegroups/southindia/providers/Microsoft.monitor/accounts/defaultazuremonitorworkspace-eus' and '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourcegroups/japanwest/providers/Microsoft.monitor/accounts/defaultazuremonitorworkspace-eus'"
          }
        ]
      }
    ],
    "message": "The template deployment 'microsoft.aks-1721632890149' is not valid according to the validation procedure. The tracking id is 'e5ae166d-713b-4d35-87dc-c7238c8d9130'. See inner errors for details."
  },
  "details": {
    "code": "InvalidTemplateDeployment",
    "message": "The template deployment 'microsoft.aks-1721632890149' is not valid according to the validation procedure. The tracking id is 'e5ae166d-713b-4d35-87dc-c7238c8d9130'. See inner errors for details.",
    "details": [
      {
        "code": "TemplateDeploymentValidationFailed",
        "message": "Validation failed for 'Microsoft.Dashboard/grafana'.",
        "details": [
          {
            "code": "DuplicatedSimilarAzureMonitorWorkspace",
            "message": "Due to technical limitations, integrations with multiple Azure Monitor Workspace of the same resource name is not supported. These two are having conflicting resource name: '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourcegroups/southindia/providers/Microsoft.monitor/accounts/defaultazuremonitorworkspace-eus' and '/subscriptions/a20fed83-96bd-4480-92a9-140b8e3b7c3a/resourcegroups/japanwest/providers/Microsoft.monitor/accounts/defaultazuremonitorworkspace-eus'"
          }
        ]
      }
    ]
  }
}
sykim-etri commented 1 month ago

해당 에러의 원인은 아래 코드 중 AvailabilityZones을 "1"로 고정하고 있기 때문에 AvailabilityZones이 없는 리전에 대해 에러를 발생하고 있습니다. AvailabilityZones를 입력하지 않으면 Availability Zones의 유무와 무관하게 클러스터 생성이 되긴 합니다만 AvailabilityZones이 있는 리전인데 지정하는 않게 되면 발생할 수 있는 이슈가 있을까요? @ish-hcc

https://github.com/cloud-barista/cb-spider/blob/a97d68cf546b0dfcd70e1523a0387b4258485cb2/cloud-control-manager/cloud-driver/drivers/azure/resources/ClusterHandler.go#L1302-L1321

AvailabilityZones가 있는 리전에 대해 "1"로 지정한 경우와 입력하지 않은 경우 콘솔상에서 node pool에 대한 Availability zones의 값 정도만 확인되긴 합니다.

sykim-etri commented 1 month ago

AvailabilityZones를 "1", "2", "3" 으로 지정하니 nodepool의 Availability zones가 Zone 1, Zone 2, Zone 3으로 설정되었습니다. image

sykim-etri commented 1 month ago

AvailabiltyZones(AZ) 설정값이 VirtualMachineScaleSets에 미치는 영향에 대해서 관련 문서에 자세히 설명되어 있으며, 모든 AZ로 설정하는 것이 안정성이 높긴 하겠지만 Disk(Zone)와의 연관성이 있는 것으로 보입니다.

생각해 볼 수 있는 방안은 다음과 같습니다.

  1. 현재 default zone이 "1"이므로, AZ가 있는 경우 "1"로 고정하고 AZ가 없는 경우 설정하지 않는 방안
  2. Disk와 같이 Cluster/Nodepool도 Zone을 지정하도록 확장하여 특정 Zone을 지정하는 방안

2번안은 복잡성이 꽤 높을 것으로 예상되니 1번안으로 추진하고 추후 확장하는 방안이 어떨까요? (@powerkimhub)

sykim-etri commented 1 month ago

사용자가 ConnectionInfo.RegionInfo.Zone을 설정할 수 있는 것으로 보여서 해당 값을 활용하면 될 것 같아 1번안에 이를 반영하면 될 것 같습니다.

https://github.com/cloud-barista/cb-spider/blob/a97d68cf546b0dfcd70e1523a0387b4258485cb2/cloud-control-manager/cloud-driver/drivers/azure/AzureDriver.go#L285-L303

@ish-hcc generateAgentPoolProfileProperties() 함수를 호출하는 caller 함수들에 상기 Zone 정보를 전달하는 것이 나을까요 아니면 AzureClusterHandler의 member function으로 변경하는 것이 나을까요 또는 다른 방안 등에 대해 의견 부탁드립니다.

ish-hcc commented 1 month ago

Fixed in #1259

@sykim-etri 다방면으로 테스트 해주셔서 감사합니다

@powerkimhub

powerkimhub commented 1 month ago

@sykim-etri

sykim-etri commented 4 weeks ago

AZ가 없는 경우(westus, northcentralus) 아래와 같은 에러가 발생하는 것으로 추정됩니다.

[CB-SPIDER].[ERROR]: 2024-08-07 18:56:33 ClusterHandler.go:201, github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/drivers/azure/resources.(*AzureClusterHandler).Create
Cluster() - Failed to Create Cluster. err = containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidAvailabilityZoneFormat" Message="The specified Availability Zones [] are invalid and should be in numeric format." Target="agentPoolProfile.availabilityZone" 

간단한 내용이라 몇가지 테스트 후 수정 PR를 올릴 예정입니다.