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.
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
git clone https://github.com/garden-io/garden.gitcd 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
in the project
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
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:
This builds Docker images for
frontend respectively. Next, we'll deploy the services with:
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:
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:
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.
To see how a Garden project is configured from scratch check, out the Demo Project guide for a more in-depth presentation.