Skip to content

Commit 56bb5e7

Browse files
committed
Add KubeVirt instructions to tilt.md
Signed-off-by: Johanan Liebermann <[email protected]>
1 parent 2844582 commit 56bb5e7

File tree

1 file changed

+90
-5
lines changed
  • docs/book/src/developer/core

1 file changed

+90
-5
lines changed

docs/book/src/developer/core/tilt.md

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,70 @@ workflow that offers easy deployments and rapid iterative builds.
2020
## Getting started
2121

2222
### Create a kind cluster
23-
A script to create a KIND cluster along with a local Docker registry and the correct mounts to run CAPD is included in the hack/ folder.
2423

25-
To create a pre-configured cluster run:
24+
The following CAPI infrastructure providers are suitable for local development:
25+
26+
- [CAPD](https://github.com/kubernetes-sigs/cluster-api/blob/main/test/infrastructure/docker/README.md) - uses Docker containers as workload cluster nodes
27+
- [CAPK](https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt) - uses KubeVirt VMs as workload cluster nodes
28+
29+
CAPD is the default as it's more lightweight and requires less setup. KubeVirt is useful when
30+
Docker isn't suitable for whatever reason.
31+
32+
{{#tabs name:"tab-management-cluster-creation" tabs:"Docker,KubeVirt"}}
33+
{{#tab Docker}}
34+
35+
To create a kind cluster with CAPD, run the following:
36+
37+
```bash
38+
make kind-cluster
39+
```
40+
41+
{{#/tab }}
42+
{{#tab KubeVirt}}
43+
44+
To create a kind cluster with CAPD, run the following:
45+
46+
```bash
47+
make kind-cluster-kubevirt
48+
```
49+
50+
<aside class="note">
51+
52+
KubeVirt uses *container disks* to create VMs inside pods. These are special container images which
53+
need to be pulled from a registry. To support pulling container disks from private registries as
54+
well as avoid getting rate-limited by Docker Hub (if used), the CAPK script mounts your Docker
55+
config file inside the kind cluster to let the Kubelet access your credentials.
56+
57+
The script looks for the Docker config file at `$HOME/.docker/config.json` by default. To specify
58+
a different path, set the following variable before running Make above:
59+
60+
```bash
61+
export DOCKER_CONFIG_FILE="/foo/config.json"
62+
```
63+
64+
</aside>
65+
66+
<aside class="note">
67+
68+
The CAPK script uses [MetalLB](https://metallb.org/) to expose the API servers of workload clusters
69+
on the local machine. The API servers are exposed as LoadBalancer services handled by MetalLB. For
70+
this to work, MetalLB needs to figure out your container runtime IP prefix. The script assumes
71+
Docker is used and figures the IP prefix out automatically. In case a different runtime is used,
72+
specify your container runtime's IP prefix manually (the first two octets only):
2673

2774
```bash
28-
./hack/kind-install-for-capd.sh
75+
export CAPI_METALLB_IP_PREFIX="172.20"
2976
```
3077

78+
The script uses 255.200-255.250 in the last two octets to set the range MetalLB should use to
79+
allocate IPs to LoadBalancer services. For example, for `172.20` the resulting IP range is
80+
`172.20.255.200-172.20.255.250`.
81+
82+
</aside>
83+
84+
{{#/tab }}
85+
{{#/tabs }}
86+
3187
You can see the status of the cluster with:
3288

3389
```bash
@@ -36,7 +92,10 @@ kubectl cluster-info --context kind-capi-test
3692

3793
### Create a tilt-settings file
3894

39-
Next, create a `tilt-settings.yaml` file and place it in your local copy of `cluster-api`. Here is an example that uses the components from the CAPI repo:
95+
Next, create a `tilt-settings.yaml` file and place it in your local copy of `cluster-api`.
96+
97+
{{#tabs name:"tab-tilt-settings" tabs:"Docker,KubeVirt"}}
98+
{{#tab Docker}}
4099

41100
```yaml
42101
default_registry: gcr.io/your-project-name-here
@@ -46,7 +105,33 @@ enable_providers:
46105
- kubeadm-control-plane
47106
```
48107
49-
To use tilt to launch a provider with its own repo, using Cluster API Provider AWS here, `tilt-settings.yaml` should look like:
108+
{{#/tab }}
109+
{{#tab KubeVirt}}
110+
111+
```yaml
112+
enable_providers:
113+
- kubevirt
114+
- kubeadm-bootstrap
115+
- kubeadm-control-plane
116+
provider_repos:
117+
# Path to a local clone of CAPK (replace with actual path)
118+
- ../cluster-api-provider-kubevirt
119+
kustomize_substitutions:
120+
# CAPK needs access to the containerd socket (replace with actual path)
121+
CRI_PATH: "/var/run/containerd/containerd.sock"
122+
KUBERNETES_VERSION: "v1.30.1"
123+
# An example - replace with an appropriate container disk image for the desired k8s version
124+
NODE_VM_IMAGE_TEMPLATE: "quay.io/capk/ubuntu-2204-container-disk:v1.30.1"
125+
# Allow deploying CAPK workload clusters from the Tilt UI (optional)
126+
template_dirs:
127+
kubevirt:
128+
- ../cluster-api-provider-kubevirt/templates
129+
```
130+
131+
{{#/tab }}
132+
{{#/tabs }}
133+
134+
Other infrastructure providers may be added to the cluster using local clones and a configuration similar to the following:
50135
51136
```yaml
52137
default_registry: gcr.io/your-project-name-here

0 commit comments

Comments
 (0)