This message was deleted.
# general
a
This message was deleted.
f
created a DaemonSet for this with acrictl image
Copy code
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: prune-images
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: prune-images
  template:
    metadata:
      labels:
        app: prune-images
    spec:
      hostPID: true
      containers:
      - name: prune
        image: <http://docker.io/dojobits/crictl:v1.35.0|docker.io/dojobits/crictl:v1.35.0>
        securityContext:
          privileged: true
        command:
          - sh
          - -c
          - |
            echo "Starting image prune loop"
            while true; do
              echo "Pruning unused images..."
              crictl --runtime-endpoint unix:///run/k3s/containerd/containerd.sock rmi --prune 2>&1
              sleep 1d
            done
        volumeMounts:
          - name: run
            mountPath: /run
          - name: var-run
            mountPath: /var/run
      restartPolicy: Always
      volumes:
        - name: run
          hostPath:
            path: /run
        - name: var-run
          hostPath:
            path: /var/run