spiffefs

by SPIFFE

Helm chartv0.1.1App 0.6.0Apache-2.0Verified publisher

A Helm chart to install spiffefs, a FUSE filesystem that delivers SPIFFE X.509 credentials to workloads as files.

About this chart

spiffefs

A Helm chart to install spiffefs, a FUSE filesystem that delivers SPIFFE X.509 credentials to workloads as files.

Homepage: https://github.com/spiffe/helm-charts-hardened/tree/main/charts/spiffefs

Maintainers

NameEmailUrl
marcofranssen[email protected]https://marcofranssen.nl
kfox1111[email protected]
faisal-memon[email protected]

Source Code

Requirements

Kubernetes: >=1.21.0-0

RepositoryNameVersion
file://../spire-libspire-lib0.4.0

Usage

spiffefs runs as a DaemonSet and mounts a FUSE filesystem on the host. A spiffe-csi-driver instance then publishes that directory to workloads, which read their credentials as ordinary files rather than speaking the Workload API.

It gets workload credentials over the SPIFFE Broker API, naming each reading process by pid and letting the agent attest that reference with its own workload attestor stack. Trust bundles arrive inline on the same stream, so what a workload is told to trust follows from its own registration entry. The Delegated Identity API is not supported.

That endpoint is mutually authenticated, so spiffefs needs its own registration entry: it fetches an svid for itself from the workload api socket and presents it as the client certificate. The spire chart ships that entry, matched on the app.kubernetes.io/name: spiffefs label this chart sets.

Both sockets are found on the host, and the agent has to be told to publish the broker one and to let spiffefs connect — this chart cannot do that for you:

spire-agent:
  sockets:
    broker:
      enabled: true
      mountOnHost: true
  brokerAPI:
    brokers:
      spiffefs:
        enabled: true
  workloadAttestors:
    k8s:
      brokerAPI:
        brokers:
          spiffefs:
            enabled: true

brokerSocketPath defaults to where the spire-agent chart publishes its broker socket, which is also where the spire-ha-agent chart serves its own, so either can be the upstream without further configuration.

The simplest way to deploy it is through the spire chart, which wires up both this chart and a matching CSI driver instance when spiffefs.enabled is set. See examples/spiffefs for a working configuration.

The CSI driver publishes the parent of mountPath, so workloads read the files one level down — <volume mountPath>/private/credential-bundle.private-key.x509.pem with the default settings. Publishing the mount point itself would tie a workload to a single filesystem instance, which is orphaned as soon as spiffefs restarts.

A workload consuming the filesystem must set mountPropagation: HostToContainer on its volume mount. spiffefs remounts its filesystem when it restarts, and a mount without it keeps the old, disconnected filesystem, so reads fail from the first restart on. When deployed through the spire chart, a ValidatingAdmissionPolicy rejects pods that mount the volume any other way. Where the cluster serves MutatingAdmissionPolicy, a mount that leaves it unset is given HostToContainer instead of being rejected.

The node's root filesystem must be a shared mount, which is the default on systemd hosts. The CSI driver instance mounts the socket directory HostToContainer, so spiffefs restarts reach it. The runtime still makes that mount shared, because the driver's pod also has a Bidirectional volume, so the driver makes its own view a slave of the node's mount when it starts. This has been tested with containerd; CRI-O has not been tested.

Parameters

spiffefs chart parameters

NameDescriptionValue
image.registryThe OCI registry to pull the image fromghcr.io
image.repositoryThe repository within the registryspiffe/spiffefs
image.pullPolicyThe image pull policyIfNotPresent
image.tagOverrides the image tag whose default is the chart appVersion""
mountPathHost directory spiffefs mounts its filesystem on. Its parent is what the spiffe-csi-driver instance publishes, so workloads read the files one level down. The parent must match that instance's agentSocketPath directory./run/spire/k8s/spiffefs/private
brokerSocketPathHost path to the broker api socket spiffefs gets workload credentials from./run/spire/agent/sockets/csi.spiffe.io/broker/broker.sock
workloadSocketPathHost path to the workload api socket spiffefs gets its own svid from./run/spire/agent-sockets/spire-agent.sock
updateStrategy.typeThe update strategy to use to replace existing DaemonSet pods with new pods. Can be RollingUpdate or OnDelete.RollingUpdate
updateStrategy.rollingUpdate.maxUnavailableMax unavailable pods during update. Can be a number or a percentage.1
readinessProbe.initialDelaySecondsInitial delay seconds for the readiness probe2
readinessProbe.periodSecondsHow often to check that the filesystem is still mounted5
readinessProbe.timeoutSecondsTimeout value in seconds for the readiness probe2
resourcesResource requests and limits for spiffefs{}
extraEnvVarsExtra environment variables to be added to the spiffefs container[]
initContainersInit containers to add to the spiffefs DaemonSet[]
extraContainersExtra containers to add to the spiffefs DaemonSet[]
extraVolumesExtra volumes to add to the spiffefs DaemonSet[]
extraVolumeMountsExtra volume mounts to add to the spiffefs container[]
imagePullSecretsImage pull secret details for spiffefs[]
nameOverrideName override for spiffefs""
fullnameOverrideFull name override for spiffefs""
namespaceOverrideNamespace to install spiffefs into""
serviceAccount.createSpecifies whether a service account should be createdtrue
serviceAccount.annotationsAnnotations to add to the service account{}
serviceAccount.nameThe name of the service account to use. If not set and create is true, a name is generated.""
podAnnotationsPod annotations for spiffefs{}
podLabelsLabels to add to pods{}
securityContextSecurity context for the spiffefs container. Mounting FUSE and reading caller pi

Deploy spiffefs with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has spiffefs on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartspiffefs is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply