3

Updating Flux Installation Using the Latest Binary from CLI

 1 year ago
source link: https://techno-tim.github.io/posts/update-flux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Posted Feb 4, 2023 Updated Feb 4, 2023
By Techno Tim
2 min read

What is Fux?

Flux is a tool for keeping Kubernetes clusters in sync with sources of configuration (like Git repositories), and automating updates to configuration when there is new code to deploy. It’s open source and you can read more about it on the GitHub repo. Looking for a turial on how use this? Check out this video on how to use SOPS and Age for your Git Repos!

Updating Flux

We’re going to use curl so you’ll want to be sure you have it install

curl -V

This should return something simiar to the following

curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
sudo apt update && sudo apt install curl

Then we’ll want to download the latest Flux binary by running

curl -s https://fluxcd.io/install.sh | sudo bash

Then we’ll want to be sure it’s installed properly by running

flux -v

This should return something simialr to the following

flux version 0.39.0

Next we’ll need to locate our gotk-components.yaml file for flux in our git repo. For example, mine lives in clusters/cluster-01/base

clusters
├── cluster-01
│   ├── base
│   │   └── flux-system
│   │       └── gotk-components.yaml

One you locate gotk-components.yaml we’ll patch it by using the following command

flux install --export > clusters/cluster-01/base/flux-system/gotk-components.yaml

After this file is updated, you can check to be sure it updated the correct file by running

git diff

You should see something like the following

diff --git a/clusters/cluster-01/base/flux-system/gotk-components.yaml b/clusters/cluster-01/base/flux-system/gotk-components.yaml
index 79576f0f..9c26b708 100644
--- a/clusters/cluster-01/base/flux-system/gotk-components.yaml
+++ b/clusters/cluster-01/base/flux-system/gotk-components.yaml
@@ -1,6 +1,6 @@
 ---
 # This manifest was generated by flux. DO NOT EDIT.
-# Flux Version: v0.38.3
+# Flux Version: v0.39.0
 # Components: source-controller,kustomize-controller,helm-controller,notification-controller
 apiVersion: v1
 kind: Namespace
@@ -8,7 +8,7 @@ metadata:
   labels:
     app.kubernetes.io/instance: flux-system
     app.kubernetes.io/part-of: flux
-    app.kubernetes.io/version: v0.38.3
+    app.kubernetes.io/version: v0.39.0
     pod-security.kubernetes.io/warn: restricted
     pod-security.kubernetes.io/warn-version: latest
   name: flux-system
@@ -23,7 +23,7 @@ metadata:
     app.kubernetes.io/component: notification-controller
     app.kubernetes.io/instance: flux-system
     app.kubernetes.io/part-of: flux
-    app.kubernetes.io/version: v0.38.3
+    app.kubernetes.io/version: v0.39.0
   name: alerts.notification.toolkit.fluxcd.io
:

if you see something other than the original gotk-components.yaml being updated, you might want to check the location of the file and try again.

Once this is updated, you can simply commit and push this up and let GitOps do the rest!

git add .
git commit -m "feat(flux): Upgraded flux to 0.39.0" # replace with your verion
git push

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK