|
1 | 1 | # Rapid iterative development with Tilt
|
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This document describes how to use [kind](https://kind.sigs.k8s.io) and [Tilt](https://tilt.dev) for a simplified workflow that offers easy deployments and rapid iterative builds. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +1. [Docker](https://docs.docker.com/install/) v19.03 or newer |
| 10 | +2. [kind](https://kind.sigs.k8s.io) v0.9 or newer (other clusters can be |
| 11 | + used if `preload_images_for_kind` is set to false) |
| 12 | +3. [kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/) |
| 13 | +4. [Tilt](https://docs.tilt.dev/install.html) v0.22.2 or newer |
| 14 | +5. [envsubst](https://github.com/drone/envsubst) or similar to handle |
| 15 | + clusterctl var replacement |
| 16 | +6. Clone the [Cluster API](https://github.com/kubernetes-sigs/cluster-api) repository |
| 17 | + locally |
| 18 | +7. Clone the [cluster-api-provider-ibmcloud](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud) repository you want to deploy locally as well |
| 19 | + |
| 20 | +## Create a kind cluster |
| 21 | + |
| 22 | +First, make sure you have a kind cluster and that your `KUBECONFIG` is set up correctly: |
| 23 | + |
| 24 | +``` bash |
| 25 | +kind create cluster |
| 26 | +``` |
| 27 | + |
| 28 | +This local cluster will be running all the cluster api controllers and become the management cluster which then can be used to spin up workload clusters on IBM Cloud. |
| 29 | + |
| 30 | +## Create a tilt-settings.json file |
| 31 | + |
| 32 | +Next, create a `tilt-settings.json` file and place it in your local copy of `cluster-api`. Here is an example: |
| 33 | + |
| 34 | +**Example `tilt-settings.json` for CAPI-IBM clusters:** |
| 35 | + |
| 36 | +Make sure to replace the parameter `IBMCLOUD_API_KEY` with a valid API key. |
| 37 | + |
| 38 | +```json |
| 39 | +{ |
| 40 | + "default_registry": "gcr.io/you-project-name-here", |
| 41 | + "provider_repos": ["../cluster-api-provider-ibmcloud"], |
| 42 | + "enable_providers": ["ibmcloud", "kubeadm-bootstrap", "kubeadm-control-plane"], |
| 43 | + "kustomize_substitutions": { |
| 44 | + "IBMCLOUD_API_KEY": "XXXXXXXXXXXXXXXXXX" |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | +**NOTE**: For information about all the fields that can be used in the `tilt-settings.json` file, check them [here](https://cluster-api.sigs.k8s.io/developer/tilt.html#tilt-settingsjson-fields). |
| 49 | + |
| 50 | +## Run Tilt |
| 51 | + |
| 52 | +To launch your development environment, run: |
| 53 | + |
| 54 | +``` bash |
| 55 | +tilt up |
| 56 | +``` |
| 57 | + |
| 58 | +Kind cluster becomes a management cluster after this point, check the pods running on the kind cluster by running `kubectl get pods -A`. |
| 59 | + |
| 60 | +## Create workload clusters |
| 61 | + |
| 62 | +To provision your workload cluster, check the `Creating a cluster` section for [VPC](/topics/vpc/creating-a-cluster.html) and [PowerVS](/topics/powervs/creating-a-cluster.html). |
| 63 | + |
| 64 | +After deploying it, check the tilt logs and wait for the clusters to be created. |
| 65 | + |
| 66 | +## Clean up |
| 67 | + |
| 68 | +Before deleting the kind cluster, make sure you delete all the workload clusters. |
| 69 | + |
| 70 | +```bash |
| 71 | +kubectl delete cluster <clustername> |
| 72 | +tilt up (ctrl-c) |
| 73 | +kind delete cluster |
| 74 | +``` |
0 commit comments