# Kubernetes Cluster Bootstrap

Source: https://docs.quake.ai/resources/iac-templates/k8s-cluster
Markdown: https://docs.quake.ai/resources/iac-templates/k8s-cluster.md

---

# Kubernetes cluster bootstrap

This pattern composes Compute, Network, and Kubernetes.

## What this template does

Bootstraps a Kubernetes cluster on Quake AI compute instances:

- Control plane node(s) with kubeadm initialization
- Worker nodes joined to the cluster
- Dedicated private network for cluster communication
- Security groups for Kubernetes API, etcd, kubelet, and NodePort ranges
- Optional floating IP for external API access

This template provisions the infrastructure. Kubernetes installation is handled via cloud-init scripts embedded in the template. See [cloud-init and first-boot configuration](/docs/compute/concepts/cloud-init).

## Parameters

| Parameter | Description | Default |
| --- | --- | --- |
| `key_name` | SSH keypair name (must already exist in your project) | required |
| `control_plane_count` | Number of control plane nodes | `1` |
| `worker_count` | Number of worker nodes | `3` |
| `cp_flavor` | Control plane instance size | `m2a.xlarge` |
| `worker_flavor` | Worker node instance size | `s1a.medium` |
| `k8s_version` | Kubernetes version | `1.31` |
| `pod_cidr` | Pod network CIDR | `10.244.0.0/16` |
| `image_name` | Operating system image | `Ubuntu-24.04` |
| `external_network` | External network for router gateway and floating IP | `PublicStatic` |
| `private_cidr` | Address range for the cluster subnet | `192.168.70.0/24` |
| `dns_nameservers` | Resolvers for the private subnet (cloud-init needs DNS to reach package mirrors) | `["8.8.8.8", "8.8.4.4"]` |

## When to use this pattern

Bootstrap a Magnum Kubernetes cluster with control plane and worker nodes on a private network. Choose compute-only patterns such as [Containerized App on Compute](/resources/iac-templates/containerized-app) when you want Docker on a single VM without cluster orchestration.

## Estimated cost

<PricingCompanion
  components={[
    { kind: "template", slug: "k8s-cluster", required: true },
  ]}
/>

## Template source

<TemplateSource slug="k8s-cluster" />

<TemplateVariations base="k8s-cluster" />

<TemplateResourceMap template="k8s-cluster" format="opentofu" />

## Customize this pattern

- [Customize a template's image and flavor](/docs/automation/how-to/customize-template-image-flavor)
- [Add a block volume to a template](/docs/automation/how-to/add-volume-to-template)
- [Parameterize a template with a tfvars file](/docs/automation/how-to/parameterize-template-tfvars)

## See also

- [Deploy the Kubernetes cluster bootstrap template with OpenTofu](/resources/deployments/deploy-k8s-cluster-template): end-to-end tutorial that applies this template, joins a worker with kubeadm, runs a test workload, and tears the stack down
- [Kubernetes service overview](/docs/kubernetes)
- [Private Network + VPN template](/resources/iac-templates/private-network-vpn)
