This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Examples

1 - Simple

Very simple example with cluster and deployment in a single repository.

Description

This example is a very simple one that shows how to define a target cluster, context, create a namespace and deploy a nginx. You can configure the name of the namespace by changing the arg environment in .kluctl.yml.

Prerequisites

  1. A running kind cluster with a context named kind-kind.
  2. Of course, you need to install kluctl. Please take a look at the installation guide, in case you need further information.

How to deploy

git clone git@github.com:kluctl/kluctl-examples.git
cd kluctl-examples/simple
kluctl diff --target simple
kluctl deploy --target simple

2 - Simple Helm

Very simple example of a helm-based deployment.

Description

This example is very similar to simple but it deploys a Helm-based nginx to give a first impression how kluctl and Helm work together.

Prerequisites

  1. A running kind cluster with a context named kind-kind.
  2. Of course, you need to install kluctl. Please take a look at the installation guide, if you need further information.
  3. You also need to install Helm. Please take a look at the Helm installation guide for further information.

How to deploy

git clone git@github.com:kluctl/kluctl-examples.git
cd kluctl-examples/simple-helm
kluctl helm-pull
kluctl diff --target simple-helm
kluctl deploy --target simple-helm

3 - Microservices demo

Complex example inspired by inspired by the Google Online Boutique Demo.

Description

This example is a more complex one and contains the files for the microservices tutorial inspired by the Google Online Boutique Demo.

Prerequisites

Please take a look at Tutorials for prerequisites.

How to deploy

Please take a look at Tutorials for deployment instructions.

4 - Hooks and jobs

Basic example on running jobs using hooks.

Introduction

Jobs only have some mutable fields making them tricky to patch/update this problem can be solved by using hooks.

In the following example we’ve marked a Job to be ran after the deployment, we’ve also specified kluctl not to wait for its completion.

apiVersion: batch/v1
kind: Job
metadata:
  name: pi
  annotations:
    kluctl.io/hook: post-deploy
    kluctl.io/hook-wait: false
spec:
  template:
    spec:
      containers:
      - name: pi
        image: perl:5.34.0
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  backoffLimit: 4