Giter VIP home page Giter VIP logo

flux-aio's Introduction

flux-aio

flux test license release

Flux All-In-One is a lightweight distribution made with Timoni for running the GitOps Toolkit controllers as a single deployable unit (Kubernetes Pod).

This distribution is optimized for running Flux on:

  • Bare clusters without a CNI plugin installed
  • Edge clusters with limited CPU and memory resources
  • Clusters where plain HTTP communication is not allowed between pods
  • Clusters with egress via HTTP/S proxies
  • Serverless clusters for cost optimisation (EKS Fargate)

The versioning of this distribution follows semver with the following format: <flux version>-<distribution release number>, e.g. 2.2.3-0.

Documentation

Quickstart Guide

To deploy Flux on Kubernetes clusters, you'll be using the Timoni CLI and a Timoni Bundle file where you'll define the configuration of the Flux controllers and their settings.

Install the Timoni CLI with:

brew install stefanprodan/tap/timoni

For other installation methods, see timoni.sh.

Install Flux on self-managed clusters

To deploy Flux AIO on a cluster without a CNI, create a Timoni Bundle file named flux-aio.cue with the following content:

bundle: {
	apiVersion: "v1alpha1"
	name:       "flux-aio"
	instances: {
		"flux": {
			module: {
				url:     "oci://ghcr.io/stefanprodan/modules/flux-aio"
				version: "latest"
			}
			namespace: "flux-system"
			values: {
				hostNetwork:     true
				securityProfile: "privileged"
				controllers: notification: enabled: false
			}
		}
	}
}

Apply the bundle with:

timoni bundle apply -f flux-aio.cue

Note that on clusters without kube-proxy, you'll have to add the following env vars to values:

values: env: {
	"KUBERNETES_SERVICE_HOST": "<host>"
	"KUBERNETES_SERVICE_PORT": "<port>"
}

You can fine tune the Flux installation using various options, for more information see the installation guide.

Changes to the flux-aio.cue bundle, can be applied in dry-run mode to see how Timoni will reconfigure Flux on the cluster:

timoni bundle apply -f flux-aio.cue --dry-run --diff

Sync from a public Git repository

To deploy the latest version of Cilium CNI and the metrics-server cluster addon, add the cluster-addons instance to the flux-aio.cue bundle:

bundle: {
	apiVersion: "v1alpha1"
	name:       "flux-aio"
	instances: {
		// flux instance omitted for brevity
		"cluster-addons": {
			module: url: "oci://ghcr.io/stefanprodan/modules/flux-git-sync"
			namespace: "flux-system"
			values: git: {
				url:  "https://github.com/stefanprodan/flux-aio"
				ref:  "refs/heads/main"
				path: "./test/cluster-addons"
			}
		}
	}
}

The above configuration, will instruct Flux to reconcile the HelmRelease manifests from the test/cluster-addons directory.

Apply the bundle with:

timoni bundle apply -f flux-aio.cue

Timoni will configure the Flux Git sync and will wait for Flux to pull the repo and deploy the cluster addons.

For more details on how to sync from private Git repositories and self-hosted Git servers, see the Git sync documentation.

Sync from a bootstrap repository

If you want to use Flux AIO with a bootstrap repository layout, you'll have to add an ignore rule for the flux-system directory and name the sync instance flux-system:

bundle: {
	apiVersion: "v1alpha1"
	name:       "flux-aio"
	instances: {
		// flux instance omitted for brevity
		"flux-system": {
			module: url: "oci://ghcr.io/stefanprodan/modules/flux-git-sync"
			namespace: "flux-system"
			values: {
				git: {
					token:  string @timoni(runtime:string:GITHUB_TOKEN)
					url:    "https://github.com/fluxcd/flux2-kustomize-helm-example.git"
					ref:    "refs/heads/main"
					path:   "clusters/production"
					ignore: "clusters/**/flux-system/"
				}
				sync: wait: false
			}
		}
	}
}

The above configuration, generates the same flux-system objects (GitRepository, Secret, Kustomization) as the flux bootstrap command.

Uninstall Flux

To remove Flux from your cluster, without affecting any reconciled workloads:

flux -n flux-system uninstall

flux-aio's People

Contributors

cezarmathe avatar georgemac avatar mauilion avatar stefanprodan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flux-aio's Issues

Using Flux-AIO without kube-proxy

Hi
Does Flux-AIO require the kube-proxy to be running?

I have been using Flux-AIO to install Calico CNI for some time now, but wanted to try out running Cilium with the kube-proxy replacement.

To enable this you have to skip the kube-proxy stage when initializing the cluster in kubeadm.

When skipping kube-proxy, Timoni will timeout and the pod will have 0/4 containers running but not ready.

Timoni Output:

2:13PM INF b:flux-aio > applying 2 instance(s)
2:13PM INF b:flux-aio > i:flux > applying module timoni.sh/flux-aio version 2.1.1
2:13PM INF b:flux-aio > i:flux > installing flux in namespace flux-system
2:13PM INF b:flux-aio > i:flux > Namespace/flux-system created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/alerts.notification.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/buckets.source.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/gitrepositories.source.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/helmcharts.source.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/helmreleases.helm.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/helmrepositories.source.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/imagepolicies.image.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/imagerepositories.image.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/imageupdateautomations.image.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/kustomizations.kustomize.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/ocirepositories.source.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/providers.notification.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > CustomResourceDefinition/receivers.notification.toolkit.fluxcd.io created
2:13PM INF b:flux-aio > i:flux > Namespace/flux-system configured
2:13PM INF b:flux-aio > i:flux > ResourceQuota/flux-system/flux created
2:13PM INF b:flux-aio > i:flux > ServiceAccount/flux-system/flux created
2:13PM INF b:flux-aio > i:flux > ClusterRoleBinding/flux created
2:13PM INF b:flux-aio > i:flux > Deployment/flux-system/flux created
2:18PM ERR timeout waiting for: [Deployment/flux-system/flux status: 'InProgress']

Can flux-aio be used to deploy apps without having git?

Context: Our EKS is isolated and cannot connect to git.
It can connect only to ECR where OCI artifacts are present.
Is it possible to do gitops in this EKS cluster using flux-aio?
Can flux-aio consume OCI artifact as an app manifest?

I see a comment fluxcd/flux2#4188 (comment).
However, I am not sure how to proceed here.

Any examples or pointers to documentation, if this is feasible.

How to deploy the controllers as daemonsets or at least redeploy in case of node failure?

In my testing, I created a cluster of three master nodes, all are untainted and can schedule normal pods.

Flux is only ever running on the node it was originally deployed on via timoni.
If this node goes down, the controllers are not deployed to other nodes.

flux events - shows logs until the node went down.
The pods show running on the node that is down:
stream logs failed Get "https://10.0.2.22:10250/containerLogs/flux-system/flux-57bd866b6d-zbrfc/helm-controller?follow=true&sinceSeconds=300&tailLines=100&timestamps=true": dial tcp 10.0.2.22:10250: connect:

problems with overriding tolerations

Hi

Im having problem getting flux to run after #53 got merged.

I have problems trying to overwrite the default tolerations of:

tolerations: *[{
		operator: "Exists"
		key:      "node.kubernetes.io/not-ready"
	}, {
		operator:          "Exists"
		key:               "node.kubernetes.io/unreachable"
		effect:            "NoExecute"
		tolerationSeconds: 300

With something like the old but more crude toleration of operation="exists". eg.

╰─➤  timoni --kubeconfig mgmt-config bundle apply -f - <<EOF                                                                                                                            127 ↵
bundle: {
        apiVersion: "v1alpha1"
        name:       "flux-aio"
        instances: {
                "flux": {
                        module: {
                          url: "oci://ghcr.io/stefanprodan/modules/flux-aio"
                          version: "2.1.2"
                        }
                        namespace: "flux-system"
                        values: {
                              hostNetwork:     true
                              securityProfile: "privileged"
                              tolerations: [{
                                operator: "Exists"
                                key: ""
                              }]
                        }
                }
        }
}
EOF


2:13PM INF b:flux-aio > applying 1 instance(s)
2:13PM INF b:flux-aio > i:flux > applying module timoni.sh/flux-aio version 2.1.2
2:14PM ERR failed to build instance:
values.tolerations: 2 errors in empty disjunction:
values.tolerations: conflicting values [{operator:"Exists",key:""}] and {key?:string,operator?:#TolerationOperator,value?:string,effect?:#TaintEffect,tolerationSeconds?:(null|int & >=-9223372036854775808 & <=9223372036854775807)} (mismatched types list and struct):
    ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:3526:14
    ./templates/config.cue:139:7
    ./timoni.cue:17:9
    ./values.cue:36:15
values.tolerations: incompatible list lengths (1 and 2)

In my testing I cannot change any of the toleration.

╰─➤  timoni --kubeconfig mgmt-config bundle apply -f - <<EOF
bundle: {
        apiVersion: "v1alpha1"
        name:       "flux-aio"
        instances: {
                "flux": {
                        module: {
                          url: "oci://ghcr.io/stefanprodan/modules/flux-aio"
                          version: "2.1.2"
                        }
                        namespace: "flux-system"
                        values: {
                              hostNetwork:     true
                              securityProfile: "privileged"
                              tolerations: [{
                                  operator: "Exists"
                                  key: ""
                                }, {
                                  operator:          "Exists"
                                  key:               "node.kubernetes.io/unreachable"
                                  effect:            "NoExecute"
                                  tolerationSeconds: 300
                                }]
                        }
                }
        }
}
EOF
2:22PM INF b:flux-aio > applying 1 instance(s)
2:22PM INF b:flux-aio > i:flux > applying module timoni.sh/flux-aio version 2.1.2
2:22PM ERR failed to build instance:
values.tolerations: 2 errors in empty disjunction:
values.tolerations: conflicting values [{operator:"Exists",key:""},{operator:"Exists",key:"node.kubernetes.io/unreachable",effect:"NoExecute",tolerationSeconds:300}] and {key?:string,operator?:#TolerationOperator,value?:string,effect?:#TaintEffect,tolerationSeconds?:(null|int & >=-9223372036854775808 & <=9223372036854775807)} (mismatched types list and struct):
    ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:3526:14
    ./templates/config.cue:139:7
    ./timoni.cue:17:9
    ./values.cue:36:15
values.tolerations.0.key: conflicting values "node.kubernetes.io/not-ready" and "":
    ./templates/config.cue:133:13
    ./timoni.cue:17:9
    ./values.cue:38:13

Maybe im doing something wrong, i just can't change anything. Copying in the defaults works fine, so it should not be a syntax problem.

Looks also like the documentation still displays to old defaults for the toleration option.

Would appreciate some help with this. flux-aio haven't been working after the Introduction of commit ebc72c2 to 2.1.2, and could'nt find a way of rolling back to a working digest of the 2.1.2 OCI image.

In my use-case nodes have the following taints due to them being provisioned by Cluster-API:

...
spec:
  taints:
  - effect: NoSchedule
    key: node-role.kubernetes.io/control-plane
  - effect: NoSchedule
    key: node.cloudprovider.kubernetes.io/uninitialized
    value: "true"
  - effect: NoSchedule
    key: node.kubernetes.io/not-ready

This means that the flux pod doesn't have the correct talerotions after #53 was merged.

Allow insecure connections to Git repositories

I am trying this in a home lab and the flux container is unable to pull the repository without a valid ssl certificate.

Also I see an issue later adding an own root CA?
Maybe I did not find the documentation to add a configmap with mount of a custom root CA via timoni?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.