Skip to content

docs: Add a guide for configuring plugins using Image Volume #5915

@sniok

Description

@sniok

In kubernetes 1.36 you can now mount docker images as volumes

https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/

This makes it a lot easier to configure plugins for in-cluster deployment, without having to deal with init containers

For example here's how Deployment yaml would look like with a flux plugin (I've tested this)

      containers:
        - name: headlamp
          image: ghcr.io/headlamp-k8s/headlamp:latest
          # ... other stuff ...
          volumeMounts:
            # mount image in the static-plugins folder
            - name: flux-plugin
              mountPath: /headlamp/static-plugins/flux
              subPath: plugins/flux
      volumes:
        # define volume from plugin image
        - name: flux-plugin
          image:
            reference: ghcr.io/headlamp-k8s/headlamp-plugin-flux:v0.6.0
            pullPolicy: IfNotPresent
Full example:
kind: Deployment
apiVersion: apps/v1
metadata:
  name: headlamp
  namespace: headlamp
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: headlamp
  template:
    metadata:
      labels:
        k8s-app: headlamp
    spec:
      containers:
        - name: headlamp
          image: ghcr.io/headlamp-k8s/headlamp:latest
          args:
            - "-in-cluster"
            - "-plugins-dir=/headlamp/plugins"
          env:
            - name: HEADLAMP_CONFIG_TRACING_ENABLED
              value: "true"
            - name: HEADLAMP_CONFIG_METRICS_ENABLED
              value: "true"
            - name: HEADLAMP_CONFIG_OTLP_ENDPOINT
              value: "otel-collector:4317"
            - name: HEADLAMP_CONFIG_SERVICE_NAME
              value: "headlamp"
            - name: HEADLAMP_CONFIG_SERVICE_VERSION
              value: "latest"
          ports:
            - containerPort: 4466
              name: http
            - containerPort: 9090
              name: metrics
          readinessProbe:
            httpGet:
              scheme: HTTP
              path: /
              port: 4466
            initialDelaySeconds: 30
            timeoutSeconds: 30
          livenessProbe:
            httpGet:
              scheme: HTTP
              path: /
              port: 4466
            initialDelaySeconds: 30
            timeoutSeconds: 30
          volumeMounts:
            - name: flux-plugin
              mountPath: /headlamp/static-plugins/flux
              subPath: plugins/flux
      volumes:
        - name: flux-plugin
          image:
            reference: ghcr.io/headlamp-k8s/headlamp-plugin-flux:v0.6.0
            pullPolicy: IfNotPresent
      nodeSelector:
        'kubernetes.io/os': linux

Metadata

Metadata

Assignees

Labels

kind/documentationCategorizes issue or PR as related to documentation.
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions