refactor(cluster)!: Update flux installation and upgrade method
Other changes include: - Rename cluster/base to cluster/flux - Add config and charts fluxtomizations - Update scripts and taskfiles to reflect changes
This commit is contained in:
17 files changed
+112
-5697
No files matched your search
@@ -94,29 +94,14 @@ It is advisable to install [pre-commit](https://pre-commit.com/) and the pre-com
|
||||
|
||||
The Git repository contains the following directories under `cluster` and are ordered below by how Flux will apply them.
|
||||
|
||||
- **base** directory is the entrypoint to Flux
|
||||
- **crds** directory contains custom resource definitions (CRDs) that need to exist globally in your cluster before anything else exists
|
||||
- **core** directory (depends on **crds**) are important infrastructure applications (grouped by namespace) that should never be pruned by Flux
|
||||
- **apps** directory (depends on **core**) is where your common applications (grouped by namespace) could be placed, Flux will prune resources here if they are not tracked by Git anymore
|
||||
|
||||
```
|
||||
cluster
|
||||
├── apps
|
||||
│ ├── default
|
||||
│ ├── kube-system
|
||||
│ ├── networking
|
||||
│ └── system-upgrade
|
||||
├── base
|
||||
│ └── flux-system
|
||||
├── core
|
||||
│ ├── cert-manager
|
||||
│ ├── kube-system
|
||||
│ ├── metallb-system
|
||||
│ └── namespaces
|
||||
└── crds
|
||||
├── cert-manager
|
||||
├── system-upgrade-controller
|
||||
└── traefik
|
||||
```sh
|
||||
📁 cluster # k8s cluster defined as code
|
||||
├─📁 flux # flux, gitops operator, loaded before everything
|
||||
├─📁 crds # custom resources, loaded before 📁 core and 📁 apps
|
||||
├─📁 charts # helm repos, loaded before 📁 core and 📁 apps
|
||||
├─📁 config # cluster config, loaded before 📁 core and 📁 apps
|
||||
├─📁 core # crucial apps, namespaced dir tree, loaded before 📁 apps
|
||||
└─📁 apps # regular apps, namespaced dir tree, loaded last
|
||||
```
|
||||
|
||||
## 🚀 Lets go
|
||||
@@ -297,50 +282,32 @@ The cluster application [external-dns](https://github.com/kubernetes-sigs/extern
|
||||
1. Verify Flux can be installed
|
||||
|
||||
```sh
|
||||
task cluster:flux:verify
|
||||
task cluster:verify
|
||||
# ► checking prerequisites
|
||||
# ✔ kubectl 1.21.5 >=1.18.0-0
|
||||
# ✔ Kubernetes 1.21.5+k3s1 >=1.16.0-0
|
||||
# ✔ prerequisites checks passed
|
||||
```
|
||||
|
||||
2. Create the `flux-system` namespace
|
||||
|
||||
```sh
|
||||
task cluster:flux:namespace
|
||||
```
|
||||
|
||||
3. Add the Age key to your cluster as a secret in-order for Flux to decrypt SOPS secrets
|
||||
|
||||
```sh
|
||||
task cluster:flux:secret
|
||||
```
|
||||
|
||||
📍 Variables defined in `./cluster/base/cluster-secrets.sops.yaml` and `./cluster/base/cluster-settings.yaml` will be usable anywhere in your YAML manifests under `./cluster` except `./cluster/base`
|
||||
|
||||
4. Push you changes to git
|
||||
2. Push you changes to git
|
||||
|
||||
📍 **Verify** all the `*.sops.yaml` and `*.sops.yml` files under the `./cluster` and `./provision` folders are **encrypted** with SOPS
|
||||
|
||||
```sh
|
||||
git add -A
|
||||
git commit -m "initial commit"
|
||||
git commit -m "Initial commit :rocket:"
|
||||
git push
|
||||
```
|
||||
|
||||
5. Install Flux
|
||||
|
||||
📍 Due to race conditions with the Flux CRDs you will have to run the below command twice. There should be no errors on this second run.
|
||||
3. Install Flux and sync the cluster to the Git repository
|
||||
|
||||
```sh
|
||||
task cluster:flux:install
|
||||
task cluster:install
|
||||
# namespace/flux-system configured
|
||||
# customresourcedefinition.apiextensions.k8s.io/alerts.notification.toolkit.fluxcd.io created
|
||||
# ...
|
||||
# unable to recognize "./cluster/base/flux-system": no matches for kind "HelmRepository" in version "source.toolkit.fluxcd.io/v1beta1"
|
||||
```
|
||||
|
||||
6. Verify Flux components are running in the cluster
|
||||
4. Verify Flux components are running in the cluster
|
||||
|
||||
```sh
|
||||
task cluster:pods -- -n flux-system
|
||||
@@ -427,7 +394,7 @@ Once you have confirmed there are no issues requesting your certificates replace
|
||||
|
||||
### 🤖 Renovatebot
|
||||
|
||||
[Renovatebot](https://www.whitesourcesoftware.com/free-developer-tools/renovate/) will scan your repository and offer PRs when it finds dependencies out of date. Common dependencies it will discover and update are Flux, Ansible Galaxy Roles, Terraform Providers, Kubernetes Helm Charts, Kubernetes Container Images, Pre-commit hooks updates, and more!
|
||||
[Renovatebot](https://www.mend.io/free-developer-tools/renovate/) will scan your repository and offer PRs when it finds dependencies out of date. Common dependencies it will discover and update are Flux, Ansible Galaxy Roles, Terraform Providers, Kubernetes Helm Charts, Kubernetes Container Images, Pre-commit hooks updates, and more!
|
||||
|
||||
The base Renovate configuration provided in your repository can be view at [.github/renovate.json5](https://github.com/k8s-at-home/flux-cluster-template/blob/main/.github/renovate.json5). If you notice this only runs on weekends and you can [change the schedule to anything you want](https://docs.renovatebot.com/presets-schedule/) or simply remove it.
|
||||
|
||||
@@ -526,10 +493,10 @@ The benefits of a public repository include:
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: flux-system
|
||||
name: flux-installation
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 5m0s
|
||||
interval: 10m
|
||||
# 6a: Change this to your user and repo names
|
||||
url: ssh://git@github.com/$user/$repo
|
||||
ref:
|
||||
|
||||
Reference in new issue
Block a user