You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Install Flux

See https://fluxcd.io/docs/installation/#install-the-flux-cli


Linux/Mac

$ curl -s https://fluxcd.io/install.sh | sudo bash


Generate a User Token

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token


Export User Token as Environment Variables

$ export GITHUB_TOKEN=xxxx
$ export GITHUB_USER=johnmehan


Bootstrap

Perform pre-check to make sure we are able to install flux.

$ flux check --pre

► checking prerequisites
✗ flux 0.19.1 <0.20.0 (new version is available, please upgrade)
✔ Kubernetes 1.21.2 >=1.19.0-0
✔ prerequisites checks passed


With Github

$ flux bootstrap github --owner=$GITHUB_USER --repository=<REPO_NAME> --branch=main --path=<CLUSTER_NAME> --personal

# example
$ flux bootstrap github --owner=$GITHUB_USER --repository=ft --branch=main --path=local --personal


Add Sources


Git Clone New Repo

$ git clone git@github.com:johnmehan/ft.git
$ cd ft
$ cd local 


Define Helm Repo

$ flux create source helm ncyd--url https://artifactory-fpark1.int.net.nokia.com/artifactory/ncyd-helm-virtual --interval 1m0s --export >helmrepo-ncyd.yaml


helmrepo-ncyd.yaml
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
  name: ncyd
  namespace: flux-system
spec:
  interval: 1m0s
  url: https://artifactory-fpark1.int.net.nokia.com/artifactory/ncyd-helm-virtual


$ git add <file>
$ git commit 
$ git push


Wait a bit and then try retrieving your list of helm sources:

$ flux get sources helm

NAME    READY   MESSAGE                                                         REVISION                                       SUSPENDED
ncyd    True    Fetched revision: 732d32e292bd0def8d5782211f139523d23880a1      732d32e292bd0def8d5782211f139523d23880a1       False


Create Helm Release

$ flux create helmrelease kafka --source=HelmRepository/ncyd --chart kafka --release-name kafka --target-namespace default --interval 5m0s --export > helmrelease-kafka.yaml

You may want to update this helmrelease to override certain values


$ vi helmrelease-kafka.yaml
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: kafka
  namespace: flux-system
spec:
  chart:
    spec:
      chart: kafka
      sourceRef:
        kind: HelmRepository
        name: ncyd
  values:
    somevalue: val
  interval: 5m0s
  releaseName: kafka
  targetNamespace: default


Now, commit this file to your git and wait a little bit before executing the following command:

$ flux get helmreleases


Create secret for flux to use to talk to the helm repository

$ kubectl create secret generic acr --from-literal username=mehan --from-literal "password=xxx" -n flux-system



References

ReferencesURL
Supercharge your Kubernetes deployments with Flux v2 and GitHub - Introductionhttps://www.youtube.com/watch?v=N6UCKF7JD7k
Get Started with Fluxhttps://fluxcd.io/docs/get-started/
Install the Flux CLIhttps://fluxcd.io/docs/installation/#install-the-flux-cli
flux2-kustomize-helm-examplehttps://github.com/fluxcd/flux2-kustomize-helm-example
  • No labels