Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for deployment using tilt #472

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
@@ -1 +1,74 @@
# Rapid iterative development with Tilt

## Overview

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.

## Prerequisites

1. [Docker](https://docs.docker.com/install/) v19.03 or newer
2. [kind](https://kind.sigs.k8s.io) v0.9 or newer (other clusters can be
used if `preload_images_for_kind` is set to false)
3. [kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/)
4. [Tilt](https://docs.tilt.dev/install.html) v0.22.2 or newer
5. [envsubst](https://github.com/drone/envsubst) or similar to handle
clusterctl var replacement
6. Clone the [Cluster API](https://github.com/kubernetes-sigs/cluster-api) repository
locally
7. Clone the [cluster-api-provider-ibmcloud](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud) repository you want to deploy locally as well

## Create a kind cluster

First, make sure you have a kind cluster and that your `KUBECONFIG` is set up correctly:

``` bash
kind create cluster
```

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.

## Create a tilt-settings.json file

Next, create a `tilt-settings.json` file and place it in your local copy of `cluster-api`. Here is an example:

**Example `tilt-settings.json` for CAPI-IBM clusters:**

Make sure to replace the parameter `IBMCLOUD_API_KEY` with a valid API key.

```json
{
"default_registry": "gcr.io/you-project-name-here",
"provider_repos": ["../cluster-api-provider-ibmcloud"],
"enable_providers": ["ibmcloud", "kubeadm-bootstrap", "kubeadm-control-plane"],
"kustomize_substitutions": {
"IBMCLOUD_API_KEY": "XXXXXXXXXXXXXXXXXX"
}
}
```
**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).

Amulyam24 marked this conversation as resolved.
Show resolved Hide resolved
## Run Tilt

To launch your development environment, run:

``` bash
tilt up
```

Kind cluster becomes a management cluster after this point, check the pods running on the kind cluster by running `kubectl get pods -A`.

## Create workload clusters

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).

After deploying it, check the tilt logs and wait for the clusters to be created.

## Clean up

Before deleting the kind cluster, make sure you delete all the workload clusters.

```bash
kubectl delete cluster <clustername>
tilt up (ctrl-c)
kind delete cluster
```