Files
k3s/k3s_rencher/README-gitops.md
T
hermesandhermes e1a7faf1fb fix(k3s): reconcile Flux from infra repository (#3)
## Summary
Move Flux K3s reconciliation from the removed `org1/k3s` repository to `org1/infra`.

## Changes
- point the `k3s` GitRepository at `org1/infra.git`
- reconcile the `./k3s_rencher` path
- update the GitOps documentation

## Verification
- `git diff --check`
- reviewed the repository tree and confirmed `org1/k3s` is absent

---------

Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: org1/infra#3
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-11-14 22:27:19 +01:00

3.0 KiB

Git-managed K3s configuration

This directory contains the Kubernetes resources that are safe to keep in Git. The intended ownership boundary is:

  • Ansible or the K3s install script bootstraps the cluster.
  • Flux installs its pinned controllers and reconciles k3s_rencher/.
  • infrastructure/ contains shared cluster defaults.
  • apps/ contains workload definitions.
  • Secrets are encrypted with SOPS or supplied by an external secrets manager.

The cluster DNS override in infrastructure/dns/ keeps gitea.rudolf.keenetic.link on the internal endpoint 192.168.1.1, where the certificate matches the hostname.

Bootstrap Flux

Install the Flux CLI on the machine with access to the K3s API, then create the Flux controllers:

kubectl apply \
  -k k3s_rencher/flux-install

kubectl wait --for=condition=Established \
  crd/gitrepositories.source.toolkit.fluxcd.io \
  crd/kustomizations.kustomize.toolkit.fluxcd.io \
  --timeout=120s

Both repositories are public, so no Git authentication Secret is required. Install the reconciliation objects:

kubectl apply -k k3s_rencher
flux check
flux get sources git -n flux-system
flux get kustomizations -n flux-system

The pinned v2.6.4 release is installed as a separate bootstrap step because the Flux CRDs must exist before the GitRepository and Kustomization objects can be applied. The root Kustomization then creates the source and reconciliation objects for this repository's main branch at the repository root and the connectivity tester main branch under ./k3s.

Local bootstrap resources

The cluster configuration is the repository root. Render it before applying:

kubectl kustomize .
kubectl apply -k .

The overlay currently installs the read-only agent account and its network policies. Add each workload namespace to its own Kustomize overlay and include ../../infrastructure/network-policies in that overlay. NetworkPolicy is namespace-scoped, so a single policy cannot cover future namespaces.

Network defaults

Managed namespaces start with deny-by-default ingress and egress. DNS is the only shared egress exception. Add explicit policies for application ingress, pod-to-pod traffic, and approved external destinations.

These policies do not restrict hostNetwork pods or traffic originating from a node. Avoid hostNetwork unless it is required and review workloads with node access separately.

Agent access

The agent account uses Kubernetes' built-in view ClusterRole. It has no Secret permissions and no write, exec, attach, or port-forward permissions. Create a short-lived token at runtime:

kubectl -n agent-gateway create token agent-readonly --duration=24h

Do not commit the token, kubeconfig, K3s join token, or an unencrypted Secret.

Cluster-specific settings

This repository currently manages one cluster, so its Kustomize entrypoint is at the root of k3s_rencher/. Keep shared policy in infrastructure/ and add cluster-specific settings there as the installation grows.