2.5 KiB
2.5 KiB
fluxcd
age / sops
Create key:
AGE_FILE=age.agekey
age-keygen -o ${AGE_FILE}
Example using sops decryption:
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: sample-sync
spec:
interval: 1m
sourceRef:
kind: GitRepository
name: git-repo-name
path: deploy/sample-app
prune: true
decryption:
provider: sops
secretRef:
name: flux-sops-age
Importing sops private key:
Using kustomization used by operator to deploy base fluxcd manifests for deployments and reconciliation.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: your-namespace
resources:
- sample-app.yaml
secretGenerator:
- name: flux-sops-age
files:
- "age.agekey=./.env.d/age.agekey" #change to private key file path
generatorOptions:
disableNameSuffixHash: true
Import using kubectl:
SECRET_NAME="flux-sops-age"
NAMESPACE="your-namespace"
kubectl create secret generic ${SECRET_NAME} \
--namespace=${NAMESPACE} \
--from-file=age.agekey=/dev/stdin #change to private key file path
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: sample-sync
spec:
interval: 1m
sourceRef:
kind: GitRepository
name: git-repo-name
path: deploy/sample-app
prune: true
decryption:
provider: sops
secretRef:
name: flux-sops-age
kustomization prune
Disable:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
kubectl patch kustomization ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS} --type merge -p '{"spec":{"prune":false}}'
Enable:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
kubectl patch kustomization ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS} --type merge -p '{"spec":{"prune":true}}'
kustomization helm release
Disable:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
kubectl patch helmrelease ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS} --type merge -p '{"spec":{"prune":false}}'
Enable:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
kubectl patch helmrelease ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS} --type merge -p '{"spec":{"prune":true}}'
Reconcile
Source git:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
flux reconcile source git ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS}
Kustomization:
FLUX_RESOURCE_NAME="???"
FLUX_RESOURCE_NS="???"
flux reconcile kustomization ${FLUX_RESOURCE_NAME} -n ${FLUX_RESOURCE_NS}