LogoLogo
Bonsai (0.13) DocsGitHubDiscord CommunityGarden Enterprise
Acorn (0.12)
Acorn (0.12)
  • Welcome!
  • 🌳Basics
    • How Garden Works
    • Quickstart Guide
    • The Stack Graph (Terminology)
  • 🌻Tutorials
    • Your First Project
      • 1. Initialize a Project
      • 2. Connect to a Cluster
      • 3. Deploy and Test
      • 4. Configure Your Project
  • 💐Using Garden
    • Configuration Overview
    • Projects
    • Modules
    • Services
    • Tests
    • Tasks
    • Workflows
    • Variables and templating
    • Module Templates
    • Using the CLI
  • 🌿Kubernetes Plugins
    • About
    • Remote K8s Plugin Configuration
      • 1. Create a Cluster
        • AWS
        • GCP
        • Azure
      • 2. Configure Container Registry (Optional)
        • AWS
        • GCP
        • Azure
      • 3. Set Up Ingress, TLS and DNS
      • 4. Configure the Provider
    • Local K8s Plugin Configuration
      • 1. Install Local Kubernetes
      • 2. Configure the Provider
    • Module Configuration
      • Container
      • Kubernetes
      • Helm
      • PersistentVolumeClaim
      • ConfigMap
    • Advanced
      • In-Cluster Building
      • Minimal RBAC Configuration for Development Clusters
      • Deploying to Production
  • 🌺Terraform Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • ☘️Pulumi Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • 🌹Other Plugins
    • Container
    • Exec (local scripts)
  • 🌼Guides
    • Installing Garden
    • Adopting Garden
    • Code Synchronization (Dev Mode)
    • Connecting a local service to a K8s cluster (Local Mode)
    • Environments and namespaces
    • Hot Reload
    • Migrating from Docker Compose to Garden
    • Using Garden in CI
  • 🌷Advanced
    • cert-manager Integration
    • Using Remote Sources
    • Custom Commands
  • 🪷Reference
    • Providers
      • conftest-container
      • conftest-kubernetes
      • conftest
      • container
      • exec
      • hadolint
      • jib
      • kubernetes
      • local-kubernetes
      • maven-container
      • octant
      • openfaas
      • pulumi
      • terraform
    • Module Types
      • configmap
      • conftest
      • container
      • exec
      • hadolint
      • helm
      • jib-container
      • kubernetes
      • maven-container
      • openfaas
      • persistentvolumeclaim
      • pulumi
      • templated
      • terraform
    • Template Strings
      • Project configuration context
      • Environment configuration context
      • Provider configuration context
      • Module configuration context
      • Remote Source configuration context
      • Project Output configuration context
      • Custom Command configuration context
      • Workflow configuration context
      • Template Helper Functions
    • Glossary
    • Commands
    • Project Configuration
    • Module Template Configuration
    • Workflow Configuration
  • 🎋Misc
    • FAQ
    • Troubleshooting
    • Telemetry
Powered by GitBook
On this page
  • Step 1 — Pick your plugins
  • Local Kubernetes
  • (Remote) Kubernetes
  • Terraform
  • Pulumi
  • Local scripts (exec)
  • Step 2 — Add your modules
  • Step 3 — Add more plugins and environments

Was this helpful?

  1. Guides

Adopting Garden

This page contains a high-level overview of the steps required to adopt Garden. The configuration snippets are just for demonstration purposes to help you understand how Garden grows with your stack.

Step 1 — Pick your plugins

The first thing you do when adopting Garden is to pick the plugins you want to use. Plugins are configured via the providers field in the project level configuration. Plugins also define module types that we'll get to below.

The provider configuration will look something like this, depending on the plugins you're using (we're omitting some details here):

# At the root of your project
kind: Project
name: my-project

environments:
  - name: dev

providers:
 - name: kubernetes
   environments: ["dev"]

Each plugin has a dedicated section in our documentation that explains how it works and how you can get started using it.

We recommend starting simple with a single plugin and adding more as needed. In most cases you'll want to start with either the kubernetes or local-kubernetes plugins and build from there.

Below you'll find a brief overview of our main plugins. Once you know what you need, we suggest heading to the "Configure Plugin" guide for your plugin of choice.

Local Kubernetes

This plugin is great for kicking the tires and for solo projects that you can comfortably run on your laptop.

(Remote) Kubernetes

This is a great pick for teams building apps that run on Kubernetes because:

  • It allows you develop in remote, production-like environments that scale with your stack.

  • You don't need any dependencies on your laptop, even the builds happen remotely.

  • It allows you to share build and test caches with your entire team and across environments. This can dramatically speed up pipelines and development.

  • It allows you to easily create preview environments that you can share with others, e.g. for pull requests.

Terraform

It allows you to:

  • Reference outputs from your Terraform stack in your other services. You can e.g. pass a database hostname to a given service without "hard coding" any values.

  • Provision infrastructure ahead of deploying your project in a single command.

Pick this plugin if you're already using Terraform and want to codify the relationship between your runtime services and Terraform stack.

Pulumi

Local scripts (exec)

It's great for executing auth scripts, running services locally, and as a general purpose escape hatch.

It's built in which means you don't need to specify it in the project level configuration and you can simply add exec modules right away.

Step 2 — Add your modules

Garden modules and their configuration can be spread across different files and even across git repos.

Once you've configured your plugin(s), it's time to add modules.

Modules are the components that make up your stack and can contain services, tests, and tasks.

How they're configured depends on the module types and plugins you're using.

We recommend putting each module in its own garden.yml file and locate it next to any source files. For demonstration purposes, here's what a (slightly simplified) Garden project could look like in a single file:

# At the root of your project.
kind: Project
name: my-project

environments:
  - name: dev

providers:
 - name: kubernetes
   environments: ["dev"]

---

kind: Module
name: db
repo: https://charts.bitnami.com/bitnami
chart: postgresql
version: 12.1.2
tasks:
  - name: db-seed
    command: ["/bin/sh", "-c", "psql -U postgres <...>"]

---

kind: Module
name: api
type: kubernetes
files: [path/to/your/k8s/manifests]
dependencies: [db-seed]

---

kind: Module
name: web
type: container
dependencies: [api]
tests:
  - name: e2e
services:
  - name: web-service
    # ...

Depending on the size of your project, you may want to add a handful of modules to get started and then gradually add more as needed.

Step 3 — Add more plugins and environments

Garden works great during development, and for running tests and creating preview environments in CI.

We recommend adopting Garden in one part of your software delivery cycle to begin and then gradually introducing more.

A common path looks something like this:

  1. Start by using Garden in CI to create preview environments.

  2. Roll Garden out to developers and add production-like dev environments.

  3. Use Garden for running end-to-end tests, as you code, and in CI pipelines.

  4. Use Garden for production deployments or integrate it with your existing tools.

At this point, a simplified configuration could look something like the following:

# At the root of your project
kind: Project
name: my-project

environments:
  - name: dev
    variables:
      hostname: dev.my-company.com
  - name: staging
    variables:
      hostname: staging.my-company.com

providers:
 - name: kubernetes
   environments: ["dev, staging"]
   hostname: ${var.hostname}
 - name: terraform # <--- Use the Terraform plugin for the staging environment to provision a DB
   environments: ["staging"]
---
kind: Module
name: db
type: helm
disabled: "${environment.name != 'dev'}" # <--- Toggle based on env
---
kind: Module
name: db
type: terraform
disabled: "${environment.name != 'staging'}" # <--- Toggle based on env
---
kind: Module
name: web
type: kubernetes
files: "[path/to/your/${environment.name}/k8s/manifests]" # <--- Pick manifests based on env

At this point you'll have codified all your workflows such that they are portable across environments and you can go from zero to a running system in a single command.

Now that you have a feel for how our users typically adopt Garden, we recommend heading to the documentation for your plugin of choice, and to start Gardenifying your project.

PreviousInstalling GardenNextCode Synchronization (Dev Mode)

Last updated 1 year ago

Was this helpful?

The is usually the easiest way to get started. All you need is a local Kubernetes installation (e.g. Minikube or Docker for Desktop) and a project to deploy.

Our uses this plugin.

To use the you'll need access to a Kubernetes cluster so it may require a bit of up-front work.

The is usually used in conjunction with the Kubernetes plugin to provision infrastructure and/or cloud managed services such as databases.

The is very similar to the Terraform plugin (see above) except for use with Pulumi.

The allows you to execute arbitrary scripts on the host (e.g. your laptop or CI runner).

And if you have any questions, don't hesitate to reach out to our .

🌼
local Kubernetes
Quickstart Guide
Kubernetes plugin
Terraform plugin
Pulumi plugin
Exec plugin
our Discord community