Open nataliagranato opened 2 weeks ago
Ao tentar remover o cluster tambem ha erros:
# mgc_kubernetes_cluster.cluster will be destroyed
- resource "mgc_kubernetes_cluster" "cluster" {
- addons = {
- loadbalance = "" -> null
- secrets = "" -> null
- volume = "" -> null
} -> null
- controlplane = {
- auto_scale = {
- max_replicas = 3 -> null
- min_replicas = 3 -> null
} -> null
- created_at = "2024-06-17T18:02:04Z" -> null
- id = "d1d9e985-6f8e-4aa4-8371-9cf716a4a3a2" -> null
- instance_template = {
- disk_size = 0 -> null
- disk_type = "" -> null
- flavor = {
- id = "4f53ba5b-afd6-4e91-b9c9-10e363dd4988" -> null
- name = "cloud-k8s.cp.i1-c4-r8-d40" -> null
- ram = 8 -> null
- size = 40 -> null
- vcpu = 4 -> null
} -> null
- node_image = "ubuntu-2204-kube-v1.28.5" -> null
} -> null
- labels = {
- "cluster.x-k8s.io/cluster-name" = "cluster-example"
- "mke/monitoring" = "true"
} -> null
- name = "cluster-example-control-plane" -> null
- replicas = 3 -> null
- security_groups = [] -> null
- status = {
- messages = [
- "Initializing Control Plane Machines",
] -> null
- state = "Pending" -> null
} -> null
- tags = [] -> null
- taints = [] -> null
- updated_at = "2024-06-17T18:02:05Z" -> null
- zone = [] -> null
} -> null
- created_at = "2024-06-17T18:01:42Z" -> null
- current_node_pools = [] -> null
- description = "Cluster Example" -> null
- enabled_bastion = false -> null
- enabled_server_group = false -> null
- id = "1ca297c0-62a4-4d95-b8f4-22b512dccbfb" -> null
- kube_api_server = {
- floating_ip = "" -> null
- port = 0 -> null
} -> null
- name = "cluster-example" -> null
- network = {
- cidr = "" -> null
- name = "" -> null
- subnet_id = "" -> null
- uuid = "" -> null
} -> null
- node_pools = [] -> null
- project_id = "753eb15ff43c4f3c90b6ceaae881a5b1" -> null
- region = "" -> null
- status = {
- message = "Initializing Control Plane Machines" -> null
- state = "Pending" -> null
} -> null
- tags = [] -> null
- updated_at = "2024-06-17T18:02:05Z" -> null
- version = "v1.28.5" -> null
}
# time_sleep.wait_15_minutes will be destroyed
- resource "time_sleep" "wait_15_minutes" {
- create_duration = "15m" -> null
- id = "2024-06-17T18:17:22Z" -> null
}
Plan: 0 to add, 0 to change, 2 to destroy.
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
time_sleep.wait_15_minutes: Destroying... [id=2024-06-17T18:17:22Z]
time_sleep.wait_15_minutes: Destruction complete after 0s
mgc_kubernetes_cluster.cluster: Destroying... [id=1ca297c0-62a4-4d95-b8f4-22b512dccbfb]
╷
│ Error: Unable to delete mgc_kubernetes_cluster
│
│ Service returned with error: (unknown) 400 Bad Request - cluster is in Provisioning phase (request-id:
│ 84bb1837-b5da-4840-96cd-b711ab8ce8ba)
╵
Podem verificar? @geffersonFerraz @publi0 @lucas-p-lb @lfpicoloto1
Oi @nataliagranato conseguiria compartilhar como está o seu código no tf? Pelo que compartilhou, este problema ocorre pois ele cria o cluster, porém o mesmo ainda não está pronto para os nodepools, isso porque a criação do cluster ainda não foi finalizada. A API que provisiona o cluster é async, por isso este problema. No exemplo neste repositório, o que fazemos para contornar o problema é colocar um sleep para aguardar a criação do cluster. Se você utilizou o exemplo, talvez seja melhor aumentar o tempo de sleep. Já sabemos que este comportamento não está legal. Estamos trabalhando para melhorar!
@lfpicoloto1 Bom dia. Estou utilizando o exemplo do repositório, alterei o time_sleep
para 30 minutos, mas enfrento erro logo no terraform plan
:
`terraform init --upgrade
Initializing the backend...
Initializing provider plugins...
Partner and community providers are signed by their developers. If you'd like to know more about provider signing, you can read about it here: https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider selections it made above. Include this file in your version control repository so that Terraform can guarantee to make the same selections by default when you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work.
If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary. ❯ terraform plan ╷ │ Error: Unable to Convert Configuration │ │ with mgc_kubernetes_cluster.cluster, │ on main.tf line 10, in resource "mgc_kubernetes_cluster" "cluster": ❯ terraform plan ╷ │ Error: Unable to Convert Configuration │ │ with mgc_kubernetes_cluster.cluster_with_nodepool, │ on main.tf line 41, in resource "mgc_kubernetes_cluster" "cluster_with_nodepool": │ 41: resource "mgc_kubernetes_cluster" "cluster_with_nodepool" { │ `
Ao tentar criar o cluster Kubernetes, parece que cria a API, mas os nodegroups falham na criacao.