Skip to main content

okustera_kubernetes_cluster (Resource)

The okustera_kubernetes_cluster resource provisions and manages a production-grade Kubernetes cluster orchestrated by OpenStack Magnum in Okustera. It automatically exports authenticated, signed Kubeconfig credentials for downstream providers like hashicorp/kubernetes and helm.

Example Usage​

Complete Cluster with Downstream Helm Provider Integration​

resource "okustera_kubernetes_cluster_template" "k8s_tmpl" {
name = "k8s-v1.30-template"
image_id = "fedora-coreos-39"
master_flavor_id = "m1.medium"
flavor_id = "m1.large"
network_driver = "calico"
}

resource "okustera_kubernetes_cluster" "prod_cluster" {
name = "prod-k8s-cluster"
cluster_template_id = okustera_kubernetes_cluster_template.k8s_tmpl.id
master_count = 1
node_count = 3
}

# Pass synthesized Kubeconfig directly to Helm or Kubernetes providers
provider "helm" {
kubernetes {
host = okustera_kubernetes_cluster.prod_cluster.api_address
# Or load entire raw kubeconfig
}
}

output "kubeconfig" {
value = okustera_kubernetes_cluster.prod_cluster.kubeconfig
sensitive = true
}

Schema​

Required​

  • name (String) Unique human-readable name of the Kubernetes cluster.
  • cluster_template_id (String) UUID of the Magnum cluster template defining OS image and container networking.

Optional​

  • master_count (Number) Number of master / control plane nodes. Defaults to 1.
  • node_count (Number) Number of worker pool instances. Defaults to 2. Supports in-place updates/scaling.
  • keypair (String) SSH keypair name for administrative node access.
  • master_flavor_id (String) Compute flavor UUID or name for master nodes.
  • flavor_id (String) Compute flavor UUID or name for worker nodes.
  • create_timeout (Number) Timeout in minutes for cluster creation (defaults to 60).

Read-Only Attributes​

  • id (String) Unique cluster UUID.
  • status (String) Current cluster lifecycle state (e.g. CREATE_COMPLETE, UPDATE_IN_PROGRESS).
  • status_reason (String) Detailed description of current status or failure cause.
  • api_address (String) Endpoint URL of the Kubernetes API server (https://IP:6443).
  • master_addresses (List of String) Private/public IPs assigned to control plane nodes.
  • node_addresses (List of String) Private/public IPs assigned to worker pool nodes.
  • kubeconfig (String, Sensitive) Authenticated YAML kubeconfig string for direct cluster management.
  • created_at (String) Creation timestamp.
  • updated_at (String) Last modification timestamp.

Import​

Existing clusters can be imported using their UUID:

terraform import okustera_kubernetes_cluster.prod_cluster <cluster_uuid>