Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Source controller support for Instance Metadata Service v2 (IMDSv2) on AWS

Aperta
#760 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, go
Ambito
backend, cloud

Direzione di ricerca

L’issue nomina source-controller e la libreria minio-go, ma non indica file o test del repository. Inizia tracciando la configurazione delle credenziali AWS per S3 Bucket source e le richieste IMDS, quindi verifica la riconciliazione con istanze che richiedono IMDSv2 e conferma che le richieste autenticate tramite token rimuovano l’errore 401.

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

Descrizione

enhancement

I get the following error message in source-controller when Flux is configured to use S3 bucket source,:

{
  "level": "error",
  "ts": "2022-06-03T13:29:32.250Z",
  "logger": "controller.bucket",
  "msg": "Reconciler error",
  "reconciler group": "source.toolkit.fluxcd.io",
  "reconciler kind": "Bucket",
  "name": "deploy-bucket",
  "namespace": "flux-system",
  "error": "failed to confirm existence of 'retracted-flux-1ejashffo6o0p' bucket: 401 Unauthorized"
}

I have created the bucket source with the following command:

flux create source bucket deploy-bucket \
  --bucket-name=retracted-flux-1ejashffo6o0p \
  --provider=aws \
  --endpoint=s3.amazonaws.com \
  --region=eu-central-1 \
  --interval=5m

.. and receive the following error message:

✚ generating Bucket source
► applying Bucket source
✔ Bucket source created
◎ waiting for Bucket source reconciliation
✗ failed to confirm existence of 'retracted-flux-1ejashffo6o0p' bucket: 401 Unauthorized

It appears that minio-go library uses Instance Metadata Service (IMDS) at 169.254.169.254 to create temporary credentials to access the S3 bucket (from captured traffic):

GET /latest/meta-data/iam/security-credentials/ HTTP/1.1
Host: 169.254.169.254
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

This is not permitted, because my configuration requires Instance Metadata Service v2 (IMDSv2) since doing so avoids some vulnerabilities:

HTTP/1.1 401 Unauthorized
Content-Length: 0
Date: Fri, 03 Jun 2022 13:29:32 GMT
Server: EC2ws
Connection: close
Content-Type: text/plain

The fix would be to use Instance Metadata Service v2 (IMDSv2) compatible client with the minio-go library. This adds a session token to the requests.

I was able to workaround by creating an IAM user with an access key, then creating the source with--access-key and --secret-key args.

I am running Flux v0.30.2 on EKS with the Kubernetes version v1.21. I have created the IAM policy to access the bucket as instructed by documentation. Instances receive this policy from the instance profile. The access works when tested with AWS CLI aws s3 ls command.

Resources:

Lingua principale
Go
Stelle
283
Fork
252
Merge medio
1h 6m
PR unite (30g)
12

Guida per i contributori

Apri la guida per i contributori

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 fluxcd/source-controller

Tutte le issue di fluxcd/source-controller

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.