Table of Contents

# Flux

bootstrap

flux bootstrap git `
  --components-extra=image-reflector-controller,image-automation-controller `
  --url=https://gogs.davidhsaiou.com/davidhsaiou/manifest.git `
  --username=davidhsaiou `
  --password=ec813c01c99ab44c104ad38a599541656345ab00 `
  --token-auth=true `
  --interval=5m `
  --path=./clusters/host-01

create git credential

this will apply to cluster immediately

flux create secret git git-credentital `
--url=https://gogs.davidhsaiou.com/davidhsaiou/manifest.git `
--username=davidhsaiou `
--password=ec813c01c99ab44c104ad38a599541656345ab00

add track git repo

flux create source git manifest `
  --url=https://gogs.davidhsaiou.com/davidhsaiou/manifest.git `
  --branch=main `
  --interval=1m `
  --secret-ref=git-credentital `
  --export > ./clusters/host-01/manifest-source.yaml

add tack acutal app k8s resource

$service = "postgres"; `
flux create kustomization $service `
  --prune=true `
  --wait=true `
  --interval=1m `
  --retry-interval=2m `
  --health-check-timeout=15m `
  --source=manifest `
  --path="./$service" `
  --export > ./clusters/host-01/$service-kustomization.yaml

create image repo

flux create image repository officialsite `
--image=docker.davidhsaiou.com/official-website `
--interval=5m `
--secret-ref=registry-secret `
--export > ./clusters/host-01/officialsite-registry.yaml

create image policy

flux create image policy officialsite `
--image-ref=officialsite `
--filter-regex=^latest$ `
--select-alpha="asc" `
--reflect-digest=Always `
--export > ./clusters//host-01/officialsite-policy.yaml

tell flux do sync

flux reconcile kustomization flux-system --with-source

create image updater

flux create image update official-website `
--interval=5m `
--git-repo-ref=manifest `
--git-repo-path="./official-website" `
--checkout-branch=main `
--push-branch=main `
--author-name=fluxcdbot `
--author-email=fluxcdbot@davidhsaiou.com `
--commit-template="{{range .Changed.Changes}}{{print .OldValue}} -> {{println .NewValue}}{{end}}" `
--export > ./clusters/host-01/official-website-automation.yaml

add helm repo

flux create source helm grafana --url https://grafana.github.io/helm-charts --export
flux create source helm prometheus --url https://prometheus-community.github.io/helm-charts --export

create helm release

  flux create helmrelease loki --chart loki `
  --source HelmRepository/grafana `
  --chart-version 6.45.2 `
  --namespace flux-system `
  --export