Files
2026-10-21 00:11:42 +02:00

1.9 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 and installs Flux.
  • Flux reconciles k3s_rencher/.
  • infrastructure/ contains shared cluster defaults.
  • apps/ contains workload definitions.
  • Secrets are encrypted with SOPS or supplied by an external secrets manager.

Bootstrap resources

The cluster configuration is k3s_rencher/. Render it before applying:

kubectl kustomize k3s_rencher
kubectl apply -k k3s_rencher

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.