vlagent: replace the default tmpDataPath hostPath volume with emptyDir

Aperta
#2,544 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, kubernetes

Direzione di ricerca

Inizia individuando il percorso di riconciliazione o rendering di VLAgent che gestisce k8sCollector e tmpDataPath, quindi confrontalo con la configurazione predefinita della coda persistente di VMAgent. Il lavoro è completato quando il volume predefinito di VLAgent è un emptyDir montato in un percorso non appartenente all’host, mentre l’esempio fornito di security-context non-root è in grado di scrivere correttamente; esegui i test rilevanti dell’operatore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

In vlagent, when k8sCollector.enabled: true is set, the operator backs -tmpDataPath with a hostPath volume at the fixed node path /var/lib/vlagent-data by default. This can cause the following issues:

  1. Kubelet’s fsGroup ownership management does not apply to hostPath volumes. The directory is created on the node with 0755 root:root permissions and ownership, which can cause permission issues when runAsNonRoot: true is configured or on platforms such as OpenShift, where SCC admission can assign the container UID and fsGroup from the namespace’s permitted ranges, leaving the process unable to write to the root-owned host directory.
  2. Since the path is fixed rather than unique to each CR, two VLAgent CRs with k8sCollector enabled and scheduled on the same node may write to the same directory.
  3. Deleting the VLAgent still leaves its data on the node.

For comparison, VMAgent does not have these issues. By default, its persistent queue uses an emptyDir volume mounted at /tmp/vmagent-remotewrite-data.

To reproduce

Create a VLAgent with a non-root security context:

apiVersion: operator.victoriametrics.com/v1
kind: VLAgent
metadata:
  name: example
spec:
  useStrictSecurity: true
  securityContext:
    runAsUser: 65534
    runAsNonRoot: true
    fsGroup: 65534
    supplementalGroups: [0]
  k8sCollector:
    enabled: true
  # ...
Describe the solution you’d like

Back tmpDataPath with an emptyDir volume and mount it at a non-host path, the same approach as VMAgent.

Lingua principale
Go
Stelle
603
Fork
242
Merge medio
1g 14h
PR unite (30g)
57

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di VictoriaMetrics/operator

Tutte le issue di VictoriaMetrics/operator

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.