@@ -20,14 +20,73 @@ 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+ This guide offers instructions for using the following CAPI infrastructure providers for running a
25+ development environment without using real machines or cloud resources:
26+
27+ - [ CAPD] ( https://github.com/kubernetes-sigs/cluster-api/blob/main/test/infrastructure/docker/README.md ) - uses Docker containers as workload cluster nodes
28+ - [ CAPK] ( https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt ) - uses KubeVirt VMs as workload cluster nodes
29+
30+ CAPD is the default as it's more lightweight and requires less setup. KubeVirt is useful when
31+ Docker isn't suitable for whatever reason. Other infrastructure providers may be enabled as well
32+ (see [ below] ( #create-a-tilt-settings-file ) ).
33+
34+ {{#tabs name:"tab-management-cluster-creation" tabs:"Docker,KubeVirt"}}
35+ {{#tab Docker}}
36+
37+ To create a kind cluster along with a local Docker registry and the correct mounts to run CAPD, run
38+ the following:
39+
40+ ``` bash
41+ make kind-cluster
42+ ```
43+
44+ {{#/tab }}
45+ {{#tab KubeVirt}}
46+
47+ To create a kind cluster with CAPK, run the following:
48+
49+ ``` bash
50+ make kind-cluster-kubevirt
51+ ```
52+
53+ <aside class =" note " >
54+
55+ KubeVirt uses * container disks* to create VMs inside pods. These are special container images which
56+ need to be pulled from a registry. To support pulling container disks from private registries as
57+ well as avoid getting rate-limited by Docker Hub (if used), the CAPK script mounts your Docker
58+ config file inside the kind cluster to let the Kubelet access your credentials.
59+
60+ The script looks for the Docker config file at ` $HOME/.docker/config.json ` by default. To specify
61+ a different path, set the following variable before running Make above:
2662
2763``` bash
28- ./hack/kind-install-for-capd.sh
64+ export DOCKER_CONFIG_FILE= " /foo/config.json "
2965```
3066
67+ </aside >
68+
69+ <aside class =" note " >
70+
71+ The CAPK script uses [ MetalLB] ( https://metallb.org/ ) to expose the API servers of workload clusters
72+ on the local machine. The API servers are exposed as LoadBalancer services handled by MetalLB. For
73+ this to work, MetalLB needs to figure out your container runtime IP prefix. The script assumes
74+ Docker is used and figures the IP prefix out automatically. In case a different runtime is used,
75+ specify your container runtime's IP prefix manually (the first two octets only):
76+
77+ ``` bash
78+ export CAPI_METALLB_IP_PREFIX=" 172.20"
79+ ```
80+
81+ The script uses 255.200-255.250 in the last two octets to set the range MetalLB should use to
82+ allocate IPs to LoadBalancer services. For example, for ` 172.20 ` the resulting IP range is
83+ ` 172.20.255.200-172.20.255.250 ` .
84+
85+ </aside >
86+
87+ {{#/tab }}
88+ {{#/tabs }}
89+
3190You can see the status of the cluster with:
3291
3392``` bash
@@ -36,7 +95,12 @@ kubectl cluster-info --context kind-capi-test
3695
3796### Create a tilt-settings file
3897
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:
98+ Next, create a ` tilt-settings.yaml ` file and place it in your local copy of ` cluster-api ` .
99+
100+ Here are some examples:
101+
102+ {{#tabs name:"tab-tilt-settings" tabs:"Docker,KubeVirt"}}
103+ {{#tab Docker}}
40104
41105``` yaml
42106default_registry : gcr.io/your-project-name-here
@@ -46,7 +110,33 @@ enable_providers:
46110- kubeadm-control-plane
47111` ` `
48112
49- To use tilt to launch a provider with its own repo, using Cluster API Provider AWS here, ` tilt-settings.yaml` should look like:
113+ {{#/tab }}
114+ {{#tab KubeVirt}}
115+
116+ ` ` ` yaml
117+ enable_providers :
118+ - kubevirt
119+ - kubeadm-bootstrap
120+ - kubeadm-control-plane
121+ provider_repos :
122+ # Path to a local clone of CAPK (replace with actual path)
123+ - ../cluster-api-provider-kubevirt
124+ kustomize_substitutions :
125+ # CAPK needs access to the containerd socket (replace with actual path)
126+ CRI_PATH : " /var/run/containerd/containerd.sock"
127+ KUBERNETES_VERSION : " v1.30.1"
128+ # An example - replace with an appropriate container disk image for the desired k8s version
129+ NODE_VM_IMAGE_TEMPLATE : " quay.io/capk/ubuntu-2204-container-disk:v1.30.1"
130+ # Allow deploying CAPK workload clusters from the Tilt UI (optional)
131+ template_dirs :
132+ kubevirt :
133+ - ../cluster-api-provider-kubevirt/templates
134+ ` ` `
135+
136+ {{#/tab }}
137+ {{#/tabs }}
138+
139+ Other infrastructure providers may be added to the cluster using local clones and a configuration similar to the following:
50140
51141` ` ` yaml
52142default_registry : gcr.io/your-project-name-here
0 commit comments