Skip to content

Replace image-puller DaemonSet with Spegel P2P image distribution #52

@buremba

Description

@buremba

Problem

Currently using an image-puller DaemonSet to pre-cache images on all nodes. This approach:

  • Creates unnecessary pods that consume resources
  • Pods remain in "Completed" state cluttering the cluster
  • Doesn't handle image updates well
  • Each node pulls separately from registry, creating bottlenecks

Solution: Implement Spegel for P2P Image Distribution

Spegel is a lightweight, Kubernetes-native P2P registry mirror that allows nodes to share cached images with each other.

Architecture

Registry → Node A pulls & caches → Spegel shares → Node B pulls from Node A
                                                 → Node C pulls from Node A & B

Implementation Steps

  1. Remove image-puller DaemonSet

    • Delete charts/peerbot/templates/image-puller-daemonset.yaml
    • Remove related values from charts/peerbot/values.yaml
  2. Install Spegel (single command)

    helm upgrade --install spegel oci://ghcr.io/spegel-org/helm-charts/spegel \
      --namespace spegel --create-namespace \
      --set image.tag=latest
  3. Configure containerd on nodes (if needed)

    • Spegel automatically configures containerd/CRI-O
    • Works with default k3s/k8s setup

Benefits

  • 5-10x faster image distribution - nodes pull from each other
  • Zero configuration - just install and it works
  • Automatic peer discovery via Kubernetes API
  • Graceful fallback - pulls from registry if no peer has image
  • No additional infrastructure - just one lightweight DaemonSet

How it works

  1. First worker pod on Node A pulls image from registry
  2. Spegel on Node A advertises it has the image
  3. Worker pod on Node B discovers Node A has the image
  4. Node B pulls directly from Node A instead of registry
  5. Now both nodes can serve the image to others

Testing

After implementation:

  1. Deploy Spegel
  2. Start a worker pod on one node
  3. Start worker pods on other nodes
  4. Verify in logs that images are pulled from peers, not registry

Resources

This is the most minimalistic and clean solution for P2P image distribution in Kubernetes.

@claude - Please implement this by:

  1. Removing the image-puller DaemonSet
  2. Adding Spegel to the Helm chart as a dependency or documenting installation
  3. Testing that worker pods can pull images via P2P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions