siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.83k stars 546 forks source link

Add write/delete to API #7183

Open davidpanic opened 1 year ago

davidpanic commented 1 year ago

Currently there is no way that I know of to delete or write a specific file or directory on the nodes. The only existing file manipulation APIs are read and list but there is no write or delete.

I would like to have this functionality to be able to remove /var/lib/rook as it is required for correct cleanup of a Rook cluster.

To work around this I have just run a pod with an alpine container and a local volume, then deleted the directory from within the pod.

frezbo commented 1 year ago

this process is documented here: https://www.talos.dev/v1.4/kubernetes-guides/configuration/ceph-with-rook/#talos-linux-rook-metadata-removal

Adding delete api conflicts with talos philosophies.

smira commented 1 year ago

We might add some structured way to perform partial wipe of /var.

If this cluster is HA, you can wipe whole /var with talosctl reset --system-labels-to-wipe=EPHEMERAL --reboot

Ulrar commented 11 months ago

Hi,

I've created a linstor snapshot as a test, then deleted it and I'm not stuck with the underlying file in the middle of my volumes. An easy way to delete a file in /var would be useful, I guess my only option now is to figure out how to execute a privileged pod with access to that path to delete the file from there

davidpanic commented 11 months ago

@Ulrar This might come in useful, I'ts what I used to delete the rook directory:

apiVersion: batch/v1
kind: Job
metadata:
  name: cleanup-rook-dir
spec:
  ttlSecondsAfterFinished: 0
  template:
    spec:
      nodeName: talos-test-1
      containers:
      - name: cleanup
        image: alpine:latest
        command: ["rm", "-rf",  "/mnt/rook"]
        volumeMounts:
          - name: var-lib
            mountPath: /mnt
      restartPolicy: Never
      volumes:
        - name: var-lib
          hostPath:
            path: /var/lib
github-actions[bot] commented 4 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

davidpanic commented 4 months ago

Yeah, the workaround works, but it's still pretty annoying to do when there could just be an API to do it. Commenting to remove stale label.