Flux-V2-GitOps

pbates | May 4, 2022, 1:18 a.m.

Flux AWS EKS K8s Install on Ubuntu 20.04

Brew Documentation

AWS CLI Documetation

Kubectl Install

Flux Documentation

Brew CLI Ubuntu install

  • sudo apt update
  • sudo apt-get install build-essential
  • sudo apt install git -y
  • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
  • brew doctor

AWS CLI and connecting to EKS cluster

  • curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  • unzip awscliv2.zip
  • sudo ./aws/install
  • aws configure
  • Configuration Docs
  • aws eks --region us-east-1 update-kubeconfig --name Your-Clusters-Name

Kubectl Install

  • brew install kubectl
  • kubectl version --client

Flux Install and Bootstrap

  • brew install flux
  • flux check --pre

Preflight Checklist

► checking prerequisites
✗ flux 0.28.5 
✔ Kubernetes 1.22.6-eks-14c7a48 >=1.20.6-0
✔ prerequisites checks passed
  • export GITLAB_TOKEN=#############################
  • flux bootstrap gitlab --owner=messer/mymfg/infra --repository=prod-flux-fleet-2023 --hostname=gitlab.messerfinancial.com --branch=main --token-auth

Flux Bootstrap output

► connecting to github.com
✔ repository created
✔ repository cloned
✚ generating manifests
✔ components manifests pushed
► installing components in flux-system namespace
deployment "source-controller" successfully rolled out
deployment "kustomize-controller" successfully rolled out
deployment "helm-controller" successfully rolled out
deployment "notification-controller" successfully rolled out
✔ install completed
► configuring deploy key
✔ deploy key configured
► generating sync manifests
✔ sync manifests pushed
► applying sync manifests
◎ waiting for cluster sync
✔ bootstrap finished

Kubernetes Events in the flux-system namespace

Type Message Source
Normal Reconciliation finished in 866.76193ms, next run in 10m0s kustomize-controller
Normal garbage collected old artifacts source-controller
Normal artifact up-to-date with remote revision: main source-controller

Core Concepts with Flux

Gitops

So what is Gitops? Is it the same as DevOps? Gitops is a Framework and set of Tools and DevOps
is a cultural change or way of thinking. See this article for more information.

Sources

Repositories are the key, these can be in the form of GitRepos, HelmRepos, and even Buckets.
An artifact is produced by the source controller and this artifact can be consumed by other controllers.
The origin of the source artifact is checked during specified intervals. The Source-Controller is pulling
for a newer version of the manifest to update the artifact which also updates the Kubernetes objects.

Kustomization

A process using an API that allows for fetching, decrypting, building, validation, and finally
applying manifests. An object is created containing these manifests, this object is referenced
by the Source-Controller.

Reconciliation

Given state matching desired state is the key during reconciliation. This process is handled by
Kustomization-Controller.