All Projects → fluxcd → flux-kustomize-example

fluxcd / flux-kustomize-example

Licence: Apache-2.0 license
Flux v1: Example of Flux using manifest generation with Kustomize

Projects that are alternatives of or similar to flux-kustomize-example

k3s-gitops
My home Kubernetes (k3s) cluster managed by GitOps (Flux)
Stars: ✭ 26 (-63.38%)
Mutual labels:  flux, gitops
rules gitops
This repository contains rules for continuous, GitOps driven Kubernetes deployments.
Stars: ✭ 112 (+57.75%)
Mutual labels:  gitops, kustomize
Flux
Successor: https://github.com/fluxcd/flux2 — The GitOps Kubernetes operator
Stars: ✭ 6,688 (+9319.72%)
Mutual labels:  gitops, kustomize
k3s-gitops
GitOps principles to define kubernetes cluster state via code
Stars: ✭ 103 (+45.07%)
Mutual labels:  flux, gitops
gitops-catalog
Tools and technologies that are hosted on an OpenShift cluster
Stars: ✭ 163 (+129.58%)
Mutual labels:  gitops, kustomize
Book k8sInfra
< 컨테이너 인프라 환경 구축을 위한 쿠버네티스/도커 >
Stars: ✭ 176 (+147.89%)
Mutual labels:  gitops, kustomize
monokle
🧐 Monokle streamlines the process of creating, analyzing, and deploying Kubernetes configurations by providing a unified visual tool for authoring YAML manifests, validating policies, and managing live clusters.
Stars: ✭ 795 (+1019.72%)
Mutual labels:  gitops, kustomize
k8s-gitops
No description or website provided.
Stars: ✭ 23 (-67.61%)
Mutual labels:  flux, gitops
gitops-playground
Reproducible infrastructure to showcase GitOps workflows and evaluate different GitOps Operators on Kubernetes
Stars: ✭ 77 (+8.45%)
Mutual labels:  flux, gitops
htk8s
HTPC services running on Kubernetes
Stars: ✭ 69 (-2.82%)
Mutual labels:  gitops, kustomize
k8s-gitops
Homelab GitOps repository. Cluster definition state via code.
Stars: ✭ 47 (-33.8%)
Mutual labels:  flux, gitops
gitops-app-distribution
GitOps workflow for managing app delivery on multiple clusters
Stars: ✭ 22 (-69.01%)
Mutual labels:  gitops, kustomize
gitops-build-lib
Jenkins pipeline shared library for automating deployments via GitOps
Stars: ✭ 23 (-67.61%)
Mutual labels:  flux, gitops
ArtShredder
📱Banksy Shredder for iOS
Stars: ✭ 41 (-42.25%)
Mutual labels:  flux
vuex-but-for-react
A state management library for React, heavily inspired by vuex
Stars: ✭ 96 (+35.21%)
Mutual labels:  flux
bump-everywhere
🚀 Automate versioning, changelog creation, README updates and GitHub releases using GitHub Actions,npm, docker or bash.
Stars: ✭ 24 (-66.2%)
Mutual labels:  gitops
SwiftUI-Flux
🚀 This is a tiny experimental application using SwiftUI with Flux architecture.
Stars: ✭ 52 (-26.76%)
Mutual labels:  flux
base
base tool yamls (logging, monitoring, oauth, certificates, DNS)
Stars: ✭ 33 (-53.52%)
Mutual labels:  kustomize
Keras.jl
Run keras models with a Flux backend
Stars: ✭ 19 (-73.24%)
Mutual labels:  flux
Kubernetes-and-Cloud-Native-Associate-KCNA
Useful notes for the KCNA - Kubernetes and Cloud Native Associate
Stars: ✭ 162 (+128.17%)
Mutual labels:  gitops

Using Flux with Kustomize

We are moving to Flux v2

⚠️ Please note: In preparation of Flux v2 GA this repository with Flux v1 examples has been archived. The Flux v2 equivalent of what is shown here can be found at flux2-kustomize-helm-example.

Thanks a lot for your interest.

For posterity

Scenario and Goals

The following example makes use of Flux's manifest-generation feature together with Kustomize (and other such tooling, in theory).

For this example we assume an scenario with two clusters, staging and production. The goal is to levarage the full functionality of Flux (including automatic releases and supporting all fluxctl commands) to manage both clusters while minimizing duplicated declarations.

staging and production are almost identical, they both deploy a podinfo service. However, we have different requirments for each cluster:

  1. We want automated deployments for staging but not for production since we want a rubber-stamp every change. However, we want to still be able to make the changes with fluxctl.
  2. Since we expect production to have a higher load than staging, we want a higher replica range there.

How to run the example

In order to run this example, you need to:

  1. Deploy Flux version 1.13.0 or newer.

  2. Make sure to pass the flag --manifest-generation=true to fluxd, in its container spec.

  3. Fork this repository and add the fork's URL as the --git-url flag for the fluxd container.

  4. Pick an environment to run (staging or production) and ask Flux to use that environment by passing flag --git-path=staging or --git-path=production

  5. As usual, you need to make sure that the ssh key shown by fluxctl identity is added to the your github fork.

How does this example work?

├── .flux.yaml
├── base
│   ├── demo-ns.yaml
│   ├── kustomization.yaml
│   ├── podinfo-dep.yaml
│   ├── podinfo-hpa.yaml
│   └── podinfo-svc.yaml
├── staging
│   ├── flux-patch.yaml
│   └── kustomization.yaml
└── production
    ├── flux-patch.yaml
    ├── kustomization.yaml
    └── replicas-patch.yaml
  • base contains the base manifests. The resources to be deployed in staging and production are almost identical to the ones described here.
  • the staging and production directories make use of base, with a few patches, to generate the final manifests for each environment:
    • staging/kustomization.yaml and production/kustomization.yaml are Kustomize config files which indicate how to apply the patches.
    • staging/flux-patch.yaml and production/flux-patch.yaml contain environment-specific Flux annotations and the container images to be deployed in each environment.
    • production/replicas-patch.yaml increases the number of replicas of podinfo in production.
  • .flux.yaml is used by Flux to generate and update manifests. Its commands are run in the directory (staging or production). In this particular case, .flux.yaml tells Flux to generate manifests running kustomize build and update policy annotations and container images by editing flux-patch.yaml, which will implicitly applied to the manifests generated with kustomize build.

I want to know more

For a more sophisticated example of using Flux with Kustomize for creating a multitenant cluster you can go to https://github.com/fluxcd/multi-tenancy .

For more details about how .flux.yaml files work you can read the reference documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].