tencentcloudstack / terraform-provider-tencentcloud

Terraform Tencent Cloud Provider
https://www.terraform.io/docs/providers/tencentcloud/
Mozilla Public License 2.0
192 stars 133 forks source link

TKE Error: create cluster endpoint vip status still is Creating #865

Open netcmcc opened 2 years ago

netcmcc commented 2 years ago

按照文档中推荐的方式,先创建不包含worker_config 块的tencentcloud_kubernetes_cluster ,再创建单独的节点组tencentcloud_kubernetes_node_pool ,则会出现报错。

表现为集群创建后无法开启公网访问,但是托管集群必须要开启公网访问。过渡方法是必须使用worker_config 块创建至少一个节点,集群才会创建成功。希望该问题得到修复。

本问题关联:https://github.com/tencentcloudstack/terraform-provider-tencentcloud/issues/761

Terraform Version

v 1.1.2

Affected Resource(s)

Terraform Configuration Files


required_providers {
    tencentcloud = {
      source  = "tencentcloudstack/tencentcloud"
      version = "1.61.7"
    }

resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
  vpc_id                                     = local.vpc_id
  cluster_max_pod_num                        = 64
  cluster_name                               = "dev-dmhub-tke"
  cluster_version = "1.20.6"
  container_runtime = "containerd"
  network_type = "VPC-CNI"
  eni_subnet_ids = local.pod_subnet_ids
  service_cidr = "10.0.0.0/24"
  cluster_desc                               = "test cluster desc"
  cluster_internet                           = true
  managed_cluster_internet_security_policies = ["0.0.0.0/0"]
  cluster_os                                 = "tlinux3.1x86_64"
  cluster_deploy_type                        = "MANAGED_CLUSTER"

  labels = {
    "test1" = "test1",
    "test2" = "test2",
  }
}

resource "tencentcloud_kubernetes_node_pool" "mynodepool" {
  name                     = "mynodepool"
  cluster_id               = tencentcloud_kubernetes_cluster.managed_cluster.id
  max_size                 = 6
  min_size                 = 1
  vpc_id                   = local.vpc_id
  subnet_ids               = local.subnet_ids
  retry_policy             = "INCREMENTAL_INTERVALS"
  desired_capacity         = 2
  enable_auto_scale        = true
  multi_zone_subnet_policy = "EQUALITY"

  auto_scaling_config {
    instance_type      = var.default_instance_type
    system_disk_type   = "CLOUD_PREMIUM"
    system_disk_size   = "50"
    security_group_ids = ["sg-24vswocp"]

    data_disk {
      disk_type = "CLOUD_PREMIUM"
      disk_size = 50
    }

    internet_charge_type       = "TRAFFIC_POSTPAID_BY_HOUR"
    # internet_max_bandwidth_out = 10
    public_ip_assigned         = false
    # password                   = "test123#"
    key_ids = [local.key_pair_id]
    enhanced_security_service  = false
    enhanced_monitor_service   = false

  }

}

Debug Output

╷
│ Error: cls-3k4ejq67 create cluster endpoint vip status still is Creating
│
│   with tencentcloud_kubernetes_cluster.managed_cluster,
│   on main.tf line 41, in resource "tencentcloud_kubernetes_cluster" "managed_cluster":
│   41: resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
│
╵
2022-02-18T16:15:52.161+0800 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2022-02-18T16:15:52.161+0800 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2022-02-18T16:15:52.163+0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-02-18T16:15:52.166+0800 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/tencentcloudstack/tencentcloud/1.61.7/darwin_amd64/terraform-provider-tencentcloud_v1.61.7 pid=24442
2022-02-18T16:15:52.166+0800 [DEBUG] provider: plugin exited

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

Kagashino commented 2 years ago

Hi @netcmcc 这个属于 TKE 侧的产品限制,没有节点的集群不能够开启内外网访问。 对于这个限制,我们在 v1.75.6 添加了 tencentcloud_kubernetes_cluster_endpoint 用来确保内外网访问开启操作放到集群和节点 ready 之后,可以尝试更新版本并使用该资源

miaoyq commented 11 months ago

@Kagashino 请问使用tencentcloud_kubernetes_cluster_endpoint 开启公网访问,同时 cluster 的 cluster_internet 变量是不是也需要设置为true 呢,我单独用tencentcloud_kubernetes_cluster_endpoint 开启,过一会会自动关闭