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
  • Requirements
  • Limitations
  • Usage
  • Enabling and configuring cert-manager
  • Issuing your first certificate
  • Troubleshooting
  • The certificate creation timeouts and garden terminates

Was this helpful?

  1. Advanced

cert-manager Integration

PreviousUsing Garden in CINextUsing Remote Sources

Last updated 1 year ago

Was this helpful?

The cert-manager integration is deprecated and will be removed in the 0.13 release.

When starting a new Kubernetes project or when maintaining your existing ones, dealing with the creation and renewal of TLS certificates can easily become a headache. A popular tool to help automate certficate generation and renewal is .

The and providers include an integration with cert-manager. The goal of the integration is to give you a head start when setting up TLS certificates for your project, providing an easy way to install it, and some sensible defaults. We don't aim to support all the features of cert-manager, but rather accommodate the most common use case, while still allowing full control of the underlying setup when needed.

Requirements

You need to have an ingress controller configured, that is configured using Ingress resources (e.g. nginx). You can install nginx automatically by setting setupIngressController: nginx in your kubernetes provider config. You also need make sure your DNS and routing are configured to point the domains you will configure below to your ingress controller.

Limitations

cert-manager is currently under development. Currently we only support cert-manager v0.11.0, which requires Kubernetes v1.11 or higher.

If you set certManager.install: false garden will expect to find a cert-manager installation in the cert-manager namespace. If you already have installed cert-manager please verify it's running by checking the status of the main pods as suggested in the

The integration currently only supports Let's Encrypt and HTTP-01 challenges. We also only support cert-manager ClusterIssuers and not namespace Issuers.

More configuration options will be implemented, but we need your help to prioritize them! Please to request the features you need.

Usage

Enabling and configuring cert-manager

To enable cert-manager, you'll need to configure it in the kubernetes provider configuration in your project garden.yml file:

    kind: Project
    name: cert-manager-example
    environments:
    - name: remote-dev
      providers:
      - name: kubernetes
        context: your-remote-k8s-cluster-context
        setupIngressController: nginx
        ...
        certManager:
          install: true  # let garden install cert-manager
          email: name@example.com  # your email (required when requesting Let's Encrypt certificates)
          issuer: acme  # the type of issuer for the certificate generation (currently only Let's Encrypt ACME is supported)
          acmeChallengeType: HTTP-01  # type of ACME challenge (currently only "HTTP-01" is supported)
          acmeServer: letsencrypt-staging  # the ACME server to use ("letsencrypt-staging" or "letsencrypt-prod")
        tlsCertificates:
          ...

Unless you want to use your own installation of cert-manager, you will need to set the option install: true. Garden will then install cert-manager for you under the cert-manager namespace.

Note: Garden will wait until all the pods required by cert-manager will be up and running. This might take more than 2 minutes depending on the cluster.

If nothing is specified or install: false, Garden will assume you already have a valid and running cert-manager installation in the cert-manager namespace.

A valid email address is also required for Let's Encrypt certificate requests.

Issuing your first certificate

Example

When you set managedBy: cert-manager on a certificate specified in the tlsCertificates field, Garden creates a corresponding Certificate resource:

    kind: Project
    name: cert-manager-example
    environments:
    - name: remote-dev
      providers:
      - name: kubernetes
        context: your-remote-k8s-cluster-context
        ...
        certManager:
          install: true
          email: name@example.com
          issuer: acme
          acmeChallengeType: HTTP-01
          acmeServer: letsencrypt-staging
        tlsCertificates:
          - name: example-certificate-staging-01
            managedBy: cert-manager  # allow cert-manager to manage this certificate
            hostnames:
              - your-domain-name.com # the domain name(s) to be covered by the certificate
            secretRef:
              name: tls-secret-for-certificate # the secret where cert-manager will store the TLS certificate once it's generated
              namespace: cert-manager-example

The above configuration will trigger the following workflow:

  1. cert-manager will create a ClusterIssuer in your cluster which will generate your certificate. Each certificate gets an associated ClusterIssuer, which will take care of performing the issue challenge.

  2. Garden will then create a Certificate resource to request the TLS certificate.

  3. cert-manager will then automatically create an Ingress to solve the HTTP-01 ACME challenge.

  4. Once the challenge is solved the TLS certificate will be stored as a Secret using the name/namespace specified above (e.g. cert-manager-example/tls-secret-for-certificate).

All the steps above will happen at system startup/init. All your services will be built/tested/deployed after all the secrets have been populated.

Troubleshooting

The certificate creation timeouts and garden terminates

Please make sure your domain name is pointing at the right IP address.

The best way to figure out why a certificate is not being generated is using kubectl describe.

You can list all the Certificate resources with:

$: kubectl get Certificates -n your-namespace

and you can describe the failing Certificate with:

$: kubectl describe Certificate certificate-name -n your-namespace

cert-manager is a powerful tool with a lot of different possible configurations. While integrating it with Garden we decided to start with an opinionated setup which should get you up to speed quickly, without thinking too much about configuration. If/when you need specific settings or advanced use-cases, you can choose which certificates need to be managed by the integration and which you want to manage yourself using the .

For advanced configuration, please take a look at the official .

Please find more info in the guide in the official cert-manager documentation.

If have any issue, find a bug, or something is not clear from the documentation, please don't hesitate opening a new or ask us questions in .

🌷
cert-manager
kubernetes
local-kubernetes
documentation
file an issue
cert-manager documentation
"Issuing an ACME certificate using HTTP validation"
GitHub issue
our Discord community
tlsCertificates[].managedBy config field