Replies: 2 comments 27 replies
-
Only the root Flux Kustomization named |
Beta Was this translation helpful? Give feedback.
-
Sorry for reviving this old thread, but I too have some struggles with the current documentation around secrets decryption. spec:
decryption:
provider: sops
secretRef:
name: sops-age but I don't think that is the correct way. How should I add this decryption definition to the cluster? |
Beta Was this translation helpful? Give feedback.
-
So I've been using flux for many months in my cluster. I have nearly every yaml relevant to my cluster in my private repo, all nicely organised into folders where relevant. Everything was working perfectly.
I was using Longhorn for storage in my cluster until recently. I got fed up with failures it has and decided to go back to old faithful rook now that it supports arm64 natively (yay!).
I restored all the backups I had, rebuilt everything that didn't, got it all running and started work on my next project, putting encrypted secrets into my repo with sops and age. Previously I'd just kept my secrets in a file elsewhere out of my repo for security obviously. But I want to edit them and manage them the same way as everything else in my cluster in vscode. In comes sops and age.
I actually followed TechnoTim's video on the subject on YouTube, and it was super helpful in getting sops with age up and running on my computer. But getting it working in flux is the next step that I spent a while figuring out. I followed the docs (which, no hate, but I feel like there are a lot of unexplained settings in the guide for this subject that you're just expected to understand. That's for a different time) and got to the point of:
But I changed "source" for my existing repo I bootstrapped from, and "path" to "clusters/production" in my repo. And "sops-gpg" for "sops-age" obviously. I had put my encrypted secrets right in "clusters/production" where all my other yamls are, not deeper.
It reconciled, looked like everything worked fine, and then after about half an hour I decided to check on it. I just HAPPENED to see an event in the flux-system namespace saying something like "my-secrets created/changed [every single file in my repo listed out]". My heart dropped, I checked my pods, slowly every single one was deleted. Their PVCs, the data on them, every namespace referenced in my repo. All gone. Many hung due to CRD finalizers etc and many needed tidying.
Weirdly, the flux components ALSO got removed, including the flux-system namespace itself. They hung of course, because it was trying to reconcile, and bootstrapping again just made it delete everything again until the kustomizations had been fully deleted. My flux components aren't referenced in my repo other than the default bootstrapping created though.
Everything not referenced in my repo, like metallb which gets spun up directly from
kubctl apply -f [gitrepo]
stayed put, so it's clear flux caused this (through my fault, not blaming anyone other than myself).So, the actual question: what did I do wrong? Does this sound like what I did caused the issues? What should I do differently and how should I have added in-cluster decryption without flux thinking everything in my repo is a new object? Would it have been fine if my secrets were in their own path and I reference that? If this is human error, is there something flux should potentially do to prevent this? Is there something missing from the docs that could have made this clearer? I'm coming from a position of no blame, I'm simply wanting to use my failure as a learning opportunity.
Sorry for the novel, I'm just hoping to put in words what I messed up and hopefully get to the bottom of how to prevent it myself and in others. I couldn't find a more appropriate place to write this out and ask this other than directly where the specialists are.
Beta Was this translation helpful? Give feedback.
All reactions