This is the multi-page printable view of this section. Click here to print.
Examples
1 - Simple
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
- A running kind cluster with a context named
kind-kind. - 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
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
- A running kind cluster with a context named
kind-kind. - Of course, you need to install kluctl. Please take a look at the installation guide, if you need further information.
- 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
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
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