LKE cluster creation (via Terraform) - gateway timeout
I have the following TF
terraform {
required_providers {
linode = {
source = "linode/linode"
}
}
}
//Use the Linode Provider
provider "linode" {
token = var.api_token
}
//Use the linode_lke_cluster resource to create
//a Kubernetes cluster
resource "linode_lke_cluster" "foobar" {
k8s_version = var.k8s_version
label = var.label
region = var.region
tags = var.tags
pool {
# NOTE: If count is undefined, the initial node count will
# equal the minimum autoscaler node count.
type = var.pool.type
autoscaler {
min = var.pool.min
max = var.pool.max
}
}
}
//Export this cluster's attributes
output "kubeconfig" {
value = linode_lke_cluster.foobar.kubeconfig
sensitive = true
}
output "api_endpoints" {
value = linode_lke_cluster.foobar.api_endpoints
}
output "status" {
value = linode_lke_cluster.foobar.status
}
output "id" {
value = linode_lke_cluster.foobar.id
}
output "pool" {
value = linode_lke_cluster.foobar.pool
}
variable "api_token" {
description = "Your Linode API Personal Access Token. (required)"
}
variable "k8s_version" {
description = "The Kubernetes version to use for this cluster. (required)"
default = "1.29"
}
variable "label" {
description = "The unique label to assign to this cluster. (required)"
default = "default-lke-cluster"
}
variable "region" {
description = "The region where your cluster will be located. (required)"
default = "ca-central"
}
variable "tags" {
description = "Tags to apply to your cluster for organizational purposes. (optional)"
type = list(string)
default = ["testing"]
}
variable "pool" {
description = "The Node Pool type. (required)"
default = {
type = "g6-standard-1"
min = 3
max = 6
}
}
which triggered the following response from Linode
linode_lke_cluster.foobar: Creating...
linode_lke_cluster.foobar: Still creating... [10s elapsed]
linode_lke_cluster.foobar: Still creating... [20s elapsed]
linode_lke_cluster.foobar: Still creating... [30s elapsed]
linode_lke_cluster.foobar: Still creating... [40s elapsed]
linode_lke_cluster.foobar: Still creating... [50s elapsed]
linode_lke_cluster.foobar: Still creating... [1m0s elapsed]
╷
│ Error: failed to create LKE cluster: [504] Gateway timeout
│
│ with linode_lke_cluster.foobar,
│ on main.tf line 15, in resource "linode_lke_cluster" "foobar":
│ 15: resource "linode_lke_cluster" "foobar" {
│
╵
What can I do to keep Linode and Terraform communicating and not trigger this gateway timeout error ?
4 Replies
I have the same issue as above.
The final error message after what's already posted appears for me as:
failed to wait for command termination: exit status 1
In my case, the k8s cluster is created and visible in the dashboard, however terraform is unaware of it, and cannot re-apply nor destroy the resource.
I tried again tonight with success. I expect the 504 error was just transient and whatever issue there was is now resolved.
I was able to recreate the 504s with similar main.tf
and variables.tf
files when deploying clusters in Toronto. However, when I tested these same deployments in other data centers (Newark, Atlanta, Seattle) I didn't run into any issues. My suggestion would be to try out a different location to see if you get the same error.
Additionally, I took out the autoscaler
option and replaced it with the following configuration found in the Deploy LKE with Terraform documentation:
dynamic "pool" {
for_each = var.pools
content {
type = pool.value["type"]
count = pool.value["count"]
}
}
}
In my testing, this did not return 504 errors in Toronto on plan
or destroy
. However, you might need to keep the autoscaler
feature in your config for your use case.
Finally, the Linode Administrators are aware of the issue in Toronto and are currently investigating potential solutions.