aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
590 stars 553 forks source link

Failed to create kubernetes node pool #5281

Open sandysy2002 opened 2 years ago

sandysy2002 commented 2 years ago

Terraform Version Terraform v1.2.6 on windows_amd64

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files resource "alicloud_cs_managed_kubernetes" "k8s" { name = "k8s-${var.prefix}-${var.env_code}-${var.reg_code}" resource_group_id = var.resource_group_id version = "1.22.10-aliyun.1" worker_vswitch_ids = var.worker_vswitch_ids pod_cidr = var.pod_cidr service_cidr = var.service_cidr slb_internet_enabled = false kube_config = "./kubeconfig" }

resource "alicloud_cs_kubernetes_node_pool" "np" { name = "np-${var.prefix}-${var.env_code}-${var.reg_code}" cluster_id = alicloud_cs_managed_kubernetes.k8s.id vswitch_ids = var.worker_vswitch_ids instance_types = var.worker_instance_types system_disk_category = "cloud_efficiency" system_disk_size = var.worker_disk_size key_name = "key-gf-shdev"

instance_charge_type = var.instance_charge_type

period = var.period

period_unit = "Month"

auto_renew = true

auto_renew_period = 1

you need to specify the number of nodes in the node pool, which can be 0

desired_size = 1 }


Debug output:
alicloud_cs_kubernetes_node_pool.node_pool: Destroying... [id=cd55398c682d5468db51ec4f40c623463:npb01a8da0de6b44128103a29702ee3343]
alicloud_cs_kubernetes_node_pool.node_pool: Still destroying... [id=cd55398c682d5468db51ec4f40c623463:npb01a8da0de6b44128103a29702ee3343, 10s elapsed]
alicloud_cs_kubernetes_node_pool.node_pool: Still destroying... [id=cd55398c682d5468db51ec4f40c623463:npb01a8da0de6b44128103a29702ee3343, 20s elapsed]
alicloud_cs_kubernetes_node_pool.node_pool: Still destroying... [id=cd55398c682d5468db51ec4f40c623463:npb01a8da0de6b44128103a29702ee3343, 30s elapsed]
alicloud_cs_kubernetes_node_pool.node_pool: Destruction complete after 32s
alicloud_cs_managed_kubernetes.k8s: Modifying... [id=cd55398c682d5468db51ec4f40c623463]
alicloud_cs_managed_kubernetes.k8s: Modifications complete after 2s [id=cd55398c682d5468db51ec4f40c623463]
alicloud_cs_kubernetes_node_pool.np: Creating...
alicloud_cs_kubernetes_node_pool.np: Still creating... [10s elapsed]
alicloud_cs_kubernetes_node_pool.np: Still creating... [20s elapsed]
alicloud_cs_kubernetes_node_pool.np: Still creating... [30s elapsed]
╷
│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go:615: ResourceID:cd55398c682d5468db51ec4f40c623463:np411731db76224cc48fceaea3e6daeda5 , TaskID:T-62f1f841085c0205b50000b3 :
│ [ERROR] terraform-provider-alicloud/alicloud/service_alicloud_cs.go:660:
│ Failed to reach target status. Current status is failed.
│
│   with alicloud_cs_kubernetes_node_pool.np,
│   on main.tf line 12, in resource "alicloud_cs_kubernetes_node_pool" "np":
│   12: resource "alicloud_cs_kubernetes_node_pool" "np" {

Expected Behavior
Managed cluster and node pool created

Actual Behavior
Managed cluster created and node pool created with status failure

Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1. `terraform apply`
Pangjiping commented 2 years ago

The specified keyPairName does not exist. please use resource/alicloud_key_pair to create a correct key_pair if you want to use field key_name.

for example: resource "alicloud_key_pair" "default" { key_name = "tf-acc" }

resource "alicloud_cs_kubernetes_node_pool" "default" { key_name = alicloud_key_pair.default.key_name }

sandysy2002 commented 2 years ago

@Pangjiping Thanks for the comment.

Sorry I didn't state the case clearly , the key I used was already created, also like switches, they were already created in some other script.

But I have found the root cause, it is caused by the instance type I pick up is wrong. It's not available in the availability zone.

Plz close the issue and thanks again.

mehdibenfeguir commented 1 year ago

I'm not using key_name and I'm getting this error, and the nodepool fails to create Could you please help thank you

2023-09-07T11:04:43.307+0300 [DEBUG] Recoring state serial in tablestore: &tablestore.PutRowChange{TableName:"prod_lock_table", PrimaryKey:(*tablestore.PrimaryKey)(0x14001f7e708), Columns:[]tablestore.AttributeColumn{tablestore.AttributeColumn{ColumnName:"Digest", Value:"e4740b9cd9d5aef9d695b1b1fc620144", Timestamp:0}}, Condition:(*tablestore.RowCondition)(0x14001f7e720), ReturnType:0, TransactionId:(*string)(nil)}
2023-09-07T11:04:43.519+0300 [ERROR] vertex "alicloud_cs_kubernetes_node_pool.managed_node_pool" error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go:634: ResourceID:cbe9c153881d342a29e0059bc3f72dc89:np0fff2c053387467980c91a5b17dca8bb , TaskID:T-64f983fb803530069b000ebf :
[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_cs.go:732:
Failed to reach target status. Last status: failed.
2023-09-07T11:04:43.520+0300 [DEBUG] states/remote: state read serial is: 17; serial is: 17
2023-09-07T11:04:43.520+0300 [DEBUG] states/remote: state read lineage is: 2617f51e-976d-4374-a16f-2cd694593ad4; lineage is: 2617f51e-976d-4374-a16f-2cd694593ad4
╷
│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cs_kubernetes_node_pool.go:634: ResourceID:cbe9c153881d342a29e0059bc3f72dc89:np0fff2c053387467980c91a5b17dca8bb , TaskID:T-64f983fb803530069b000ebf :
│ [ERROR] terraform-provider-alicloud/alicloud/service_alicloud_cs.go:732:
│ Failed to reach target status. Last status: failed.
│
│   with alicloud_cs_kubernetes_node_pool.managed_node_pool,
│   on main.tf line 141, in resource "alicloud_cs_kubernetes_node_pool" "managed_node_pool":
│  141: resource "alicloud_cs_kubernetes_node_pool" "managed_node_pool" {
│
╵
2023-09-07T11:04:43.529+0300 [DEBUG] Retrieving state lock info from tablestore: &tablestore.SingleRowQueryCriteria{ColumnsToGet:[]string{"LockID", "Info"}, TableName:"prod_lock_table", PrimaryKey:(*tablestore.PrimaryKey)(0x14001f7f278), MaxVersion:1, TimeRange:(*tablestore.TimeRange)(nil), Filter:tablestore.ColumnFilter(nil), StartColumn:(*string)(nil), EndColumn:(*string)(nil), TransactionId:(*string)(nil)}
2023-09-07T11:04:43.592+0300 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/alicloud/1.209.1/darwin_arm64/terraform-provider-alicloud_v1.209.1 pid=31398
2023-09-07T11:04:43.592+0300 [DEBUG] provider: plugin exited
mehdibenfeguir commented 1 year ago

Expected Behavior Managed cluster and node pool created

Actual Behavior Managed cluster created and node pool created with status failure

Steps to Reproduce Please list the steps required to reproduce the issue, for example:

  1. terraform apply
mehdibenfeguir commented 1 year ago

ok I found the issue the field system_disk_category was set to cloud_efficiency and in my region only cloud_essd is available thanks @sandysy2002 your comment helped a lot