Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update explanation on Helm use case #1375

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions content/en/flux/use-cases/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Additional benefits Flux adds to Helm include:
- Automated drift detection between the desired and actual state of your operations
- Automated responses to that drift, including reconciliation, notifications, and unified logging

## Prerequisites

To follow along you'll need a Kubernetes cluster with Flux installed on it.
Please see the [get started guide](../get-started/index.md)
or the [installation guide](../installation/).


## Getting Started

The simplest way to explain is by example.
Expand All @@ -47,25 +54,26 @@ helm install my-traefik traefik/traefik \

Flux client:

Clone your bootstrap repository to your local machine and create a `traefik` directory in your bootstrap path.

```sh
flux create source helm traefik --url https://helm.traefik.io/traefik --namespace traefik --export > /flux/boot/traefik/helmrepo.yaml
flux create source helm traefik --url https://helm.traefik.io/traefik --namespace traefik --export > traefik/helmrepo.yaml
flux create helmrelease my-traefik --chart traefik \
--source HelmRepository/traefik \
--chart-version 9.18.2 \
--namespace traefik \
--export > /flux/boot/traefik/helmrepo.yaml
--export > traefik/helmrepo.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please test this with Kind, I guess the HR will fail due to the lack of LB support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose we replace traefik with nginx, and then we can use the HR from here which is e2e tested on Kind. https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/infrastructure/controllers/ingress-nginx.yaml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanprodan you are right

 Helm install failed: timed out waiting for the condition                                                                                                                                │
                                                                                                                                                                                              │
      Last Helm logs:                                                                                                                                                                         │
                                                                                                                                                                                              │
      creating 1 resource(s)                                                                                                                                                                  │
      CRD traefikservices.traefik.containo.us is already present. Skipping.                                                                                                                   │
      creating 5 resource(s)                                                                                                                                                                  │
      beginning wait for 5 resources with timeout of 5m0s                                                                                                                                     │
      Service does not have load balancer ingress IP address: flux-system/my-traefik

I will update it to use nginx

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nginx also has the same problem. Should we use podinfo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nginx does not have this issue, see the values used in the link I posted above

Copy link
Member Author

@somtochiama somtochiama Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the usecase guide, values are introduced in a later section after the helm release is applied.
So I was thinking we could start with something that just works without tweaking the values first

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK lets' use Flagger.

```

These commands save the YAML for the Flux helm custom resources to a file which can be edited and pushed to git.
When these resources are pushed to a repository that Flux watches, Flux applies them on the cluster and the Flux
Helm Controller automatically reconciles these instructions with the running state of your cluster based on your
configured rules. Alternatively, you can run the commands without the `--export` command and this will apply the
resources directly on your cluster.
These commands save the YAML for the Flux helm custom resources to the specified fil. When these resources are pushed to the
repository, Flux applies them on the cluster and the Flux Helm Controller automatically reconciles these instructions
with the running state of your cluster based on your configured rules. Alternatively, you can run the commands without
the `--export` command and this will apply the resources directly on your cluster.

Let’s check out what the Custom Resource files look like:

```yaml
# /flux/boot/traefik/helmrepo.yaml
# traefik/helmrepo.yaml
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
Expand All @@ -77,7 +85,7 @@ spec:
```

```yaml
# /flux/boot/traefik/helmrelease.yaml
# traefik/helmrelease.yaml
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down