From f7df43fbe1a88955c4b36c19755304ce7cf3fd3f Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sat, 25 Nov 2023 20:20:37 +0100 Subject: [PATCH] chore: added examples for the tldr section --- knowledge base/kubernetes/flux.md | 39 ++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/knowledge base/kubernetes/flux.md b/knowledge base/kubernetes/flux.md index a6b206c..66cd917 100644 --- a/knowledge base/kubernetes/flux.md +++ b/knowledge base/kubernetes/flux.md @@ -8,11 +8,44 @@ ## TL;DR ```sh -# Check the extension is enabled. +# Install Flux on clusters. +flux check --pre && flux install + +# Check the status of Flux's controllers and CRDs. +flux check + +# Check the cluster extension is enabled. kubectl -n 'flux-system' get extensionconfig 'fluxextension' -# Check the configuration is rolled out and properly configured. -kubectl -n 'default' get fluxconfig 'baseline-configuration' +# Create resources. +flux create source git 'base' --url 'https://github.com/user/repo' \ + --branch 'main' --interval '5m' +flux create kustomization 'base' --source 'base' --path '/' --prune true \ + --interval '3m' --health-check 'Deployment/name' --health-check-timeout '2m' + +# Check the flux configuration is rolled out and properly configured. +kubectl -n 'default' get fluxconfig 'configuration-name' +kubectl get fluxconfig 'baseline' -o jsonpath='{.spec.gitRepository.ref.branch}' + +# Check resources of configurations. +flux get -A all +flux get source git 'source-name' +flux -n 'default' get kustomization 'kustomization-name' + +# Reconcile resources. +flux reconcile kustomization 'kustomization-name' --with-source +flux -n 'default' reconcile kustomization 'kustomization-name' + +# Export resources. +flux export source git --all > 'sources.all.yaml' +flux export -n 'default' source oci 'source-name' > 'src.name.oci.default.yaml' + +# Delete resources. +flux delete kustomization 'base' +flux delete source git 'base' + +# Uninstall Flux and its CRDs. +flux uninstall ``` ## Further readings