Quick Start

This guide will walk you through setting up the Garden framework. It assumes you already have Garden installed. If you don't, please check out our installation guide.

Using the CLI

With the CLI installed, we can now try out a few commands using the Demo Project from our example projects. The example project consists of a couple of basic modules, each defining one service.

Note: Check whether Kubernetes is running with kubectl version. You should see both a Client Version and a Server Version in the response. If not, please start it up before proceeding.

Clone the repo and change into the demo-project directory:

git clone https://github.com/garden-io/garden.git
cd garden/examples/demo-project

If you'd like to use a remote Kubernetes cluster, include the option --env=remote when invoking the garden commands below, or uncomment the line

defaultEnvironment: remote

in the project garden.yml.

Note: If you want to use a remote Kubernetes cluster, make sure to update the context value in the project garden.yml with the name of your cluster context. In order to avoid mistakes, Garden will always point to the context specified in the providers configuration, regardless of what you selected with kubectl.

Also, if your remote cluster hasn't previously been set up for Garden, start by running the following from the project root:

garden plugins kubernetes cluster-init

Now, let's check the environment status by running the following:

garden get status

The response tells us how the environment is configured and the status of the providers. Next, we'll build our modules with:

garden build

This builds Docker images for backend and frontend respectively. Next, we'll deploy the services with:

garden deploy

And that's it! The garden build step above is actually unnecessary (only included here for clarity), since garden deploy will also build and rebuild modules as needed. The services are now running in your Kubernetes cluster. You can see for yourself by querying the /hello endpoint of backend's running container:

garden call backend/hello-backend

To run tests for all modules:

garden test

And if you prefer an all-in-one command that watches your project for changes and re-builds, re-deploys, and re-tests automatically, try:

garden dev

Go ahead, leave it running and change one of the files in the project, then watch it re-build.

That's it for now. Check out our Using Garden section for other features like hot reload, remote clusters, integration tests, and lots more.

Next steps

To see how a Garden project is configured from scratch check, out the Demo Project guide for a more in-depth presentation.