2018-01-12 18:24:33 +01:00
|
|
|
---
|
2021-11-23 15:25:12 +01:00
|
|
|
title: Developer Environment
|
2018-01-12 18:24:33 +01:00
|
|
|
---
|
|
|
|
|
|
2022-05-12 19:29:40 +02:00
|
|
|
## Install Kubernetes
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
You can choose any Kubernetes install of your choice. The test framework only depends on `kubectl`
|
|
|
|
|
being configured. To install `kubectl`, please see the [official guide](https://kubernetes.io/docs/tasks/tools/#kubectl).
|
2019-03-05 12:45:21 +01:00
|
|
|
|
2022-05-12 19:29:40 +02:00
|
|
|
## Minikube
|
2019-03-05 12:45:21 +01:00
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
The developers of Rook are working on Minikube and thus it is the recommended way to quickly get
|
|
|
|
|
Rook up and running. Minikube should not be used for production but the Rook authors
|
|
|
|
|
consider it great for development. While other tools such as k3d/kind are great, users have faced
|
|
|
|
|
issues deploying Rook.
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2022-02-21 13:58:12 -07:00
|
|
|
**Always use a virtual machine when testing Rook. Never use your host system where local devices may mistakenly be consumed.**
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
To install Minikube follow the [official
|
|
|
|
|
guide](https://minikube.sigs.k8s.io/docs/start/). It is recommended to use the
|
2025-06-19 18:07:27 +03:00
|
|
|
qemu2 driver when running on a Linux machine and the hyperkit driver when running on a MacOS. Both
|
2021-11-23 15:25:12 +01:00
|
|
|
allow to create and attach additional disks to the virtual machine. This is required for the Ceph
|
|
|
|
|
OSD to consume one drive. We don't recommend any other drivers for Rook. You will need a Minikube
|
|
|
|
|
version 1.23 or higher.
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
Starting the cluster on Minikube is as simple as running:
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2019-10-25 09:25:07 +02:00
|
|
|
```console
|
2021-11-23 15:25:12 +01:00
|
|
|
# On Linux
|
2025-06-19 18:07:27 +03:00
|
|
|
minikube start --disk-size=40g --extra-disks=1 --driver qemu2
|
2021-11-23 15:25:12 +01:00
|
|
|
|
2023-02-20 11:38:21 -07:00
|
|
|
# On MacOS with Intel processor
|
2021-11-23 15:25:12 +01:00
|
|
|
minikube start --disk-size=40g --extra-disks=1 --driver hyperkit
|
2023-02-20 11:38:21 -07:00
|
|
|
|
|
|
|
|
# On MacOS with Apple silicon
|
|
|
|
|
minikube start --disk-size=40g --extra-disks 1 --driver qemu
|
2018-01-12 18:24:33 +01:00
|
|
|
```
|
|
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
It is recommended to install a Docker client on your host system too. Depending on your operating
|
|
|
|
|
system follow the [official guide](https://docs.docker.com/engine/install/binaries/).
|
|
|
|
|
|
|
|
|
|
Stopping the cluster and destroying the Minikube virtual machine can be done with:
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2019-10-25 09:25:07 +02:00
|
|
|
```console
|
2021-11-23 15:25:12 +01:00
|
|
|
minikube delete
|
2018-01-12 18:24:33 +01:00
|
|
|
```
|
|
|
|
|
|
2021-11-23 15:25:12 +01:00
|
|
|
## Install Helm
|
2018-01-12 18:24:33 +01:00
|
|
|
|
2025-06-05 11:16:00 +02:00
|
|
|
Install the `helm` tool to use the helm charts rook provides. Depending on your operating system,
|
|
|
|
|
install it from system packages or follow the [official Helm guide](https://helm.sh/docs/intro/install/).
|
2023-10-03 11:53:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Using local Rook image on minikube cluster
|
|
|
|
|
|
|
|
|
|
Developers can test quickly their changes by building and using the local Rook image
|
|
|
|
|
on their minikube cluster.
|
|
|
|
|
|
|
|
|
|
1) Set the local Docker environment to use minikube:
|
|
|
|
|
|
2024-04-22 11:54:27 -06:00
|
|
|
```console
|
|
|
|
|
eval $(minikube docker-env -p minikube)
|
|
|
|
|
```
|
2023-10-03 11:53:29 +02:00
|
|
|
|
|
|
|
|
2) Build your local Rook image. The following command will generate a Rook image
|
|
|
|
|
labeled in the format `local/ceph-<arch>`.
|
|
|
|
|
|
2024-04-22 11:54:27 -06:00
|
|
|
```console
|
|
|
|
|
cd <your_rook_src_directory>
|
|
|
|
|
make BUILD_REGISTRY=local
|
|
|
|
|
```
|
2023-10-03 11:53:29 +02:00
|
|
|
|
|
|
|
|
3) Tag the generated image as `rook/ceph:master` so operator will pick it.
|
|
|
|
|
|
2024-04-22 11:54:27 -06:00
|
|
|
```console
|
|
|
|
|
docker tag "local/ceph-$(go env GOARCH)" 'rook/ceph:master'
|
|
|
|
|
```
|
2023-10-03 11:53:29 +02:00
|
|
|
|
2023-10-05 20:17:15 +02:00
|
|
|
4) Create a Rook cluster in minikube, or if the Rook cluster is already configured, apply the new
|
2023-10-03 11:53:29 +02:00
|
|
|
operator image by restarting the operator.
|
2023-10-25 13:56:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Creating a dev cluster
|
|
|
|
|
|
|
|
|
|
To accelerate the development process, users have the option to employ the script located
|
|
|
|
|
at `tests/scripts/create-dev-cluster.sh`. This script is designed to rapidly set
|
|
|
|
|
up a new minikube environment, apply the CRDs and the common file, and then utilize the
|
|
|
|
|
`cluster-test.yaml` script to create the Rook cluster. Once setup, users can use the different `*-test.yaml`
|
2023-11-07 17:58:47 +01:00
|
|
|
files from the `deploy/examples/` directory to configure their clusters. This script supports
|
|
|
|
|
the possibility of creating multiple rook clusters running on the same machine by using the option
|
|
|
|
|
`-p <profile-name>`.
|