Azure Kubernetes Service (AKS) için sık sorulan GPU profili oluşturma soruları (Önizleme)

Azure Kubernetes Service (AKS) gpu profili oluşturma için tümleştirmeleri ve profil depolamayı izleme hakkında sık sorulan soruların yanıtlarını alın. Başlamadan önce GPU profili oluşturmayı ayarlayın.

tümleştirmeleri izleme

Kendi Prometheus örneğimi Inspektor Gadget'a nasıl bağlayabilirim?

Prometheus için Azure İzleyici yönetilen hizmetini kullanmak yerine kendi Prometheus örneğinizi çalıştırıyorsanız, Inspektor Gadget pod’larından ölçüm toplayacak şekilde yapılandırın.

Inspektor Gadget, ölçümlerini aşağıdaki uç noktada kullanıma sunar:

Setting Value
Namespace gadget
Port 2224
Path /metrics

Podları bulmak ve kazımak için Prometheus yapılandırmanıza bir kazıma işi ekleyin:

Tip

Prometheus Operator dağıtımları için aynı ad alanı, etiket seçici, bağlantı noktası ve metrik yoluna sahip bir PodMonitor oluşturun.

scrape_configs:
  - job_name: "inspektor-gadget"
    kubernetes_sd_configs:
      - role: pod
        namespaces:
          names:
            - gadget
    relabel_configs:
      # Only keep pods with the k8s-app=gadget label.
      - source_labels: [__meta_kubernetes_pod_label_k8s_app]
        action: keep
        regex: gadget

      # Set the metrics path.
      - target_label: __metrics_path__
        replacement: /metrics

      # Set the metrics port.
      - source_labels: [__address__]
        action: replace
        regex: ([^:]+)(?::\d+)?
        replacement: $1:2224
        target_label: __address__

Prometheus kullanıcı arabiriminizde Durum>Hedefleri'nin altında bağlantıyı doğrulayın. İş hedefini inspektor-gadgetUP olarak göstermelidir.

Inspektor Gadget ölçümlerini kendi Grafana örneğimde nasıl görselleştirebilirim?

Prometheus örneğinizin Grafana'ya veri kaynağı olarak bağlı olduğundan emin olun. Ardından, Inspektor Gadget panosunu aşağıdaki JSON tanımından içeri aktarın:

https://raw.githubusercontent.com/inspektor-gadget/grafana-dashboards/refs/heads/main/dashboards/gpu-observability/AdvancedGPUObservability.json

Profil depolaması

Pyroscope arka ucu olarak Azure Blob Depolama nasıl kullanabilirim?

Varsayılan olarak, GPU profil oluşturma kurulum makalesindeki Pyroscope dağıtımı profilleri yerel dosya sisteminde depolar. Pod yeniden oluşturulursa profil oluşturma verileri kaybolur. Profilleri kalıcı hale getirmek için Pyroscope'ı Microsoft Entra İş Yükü Kimliği ile Azure Blob Depolama kullanacak şekilde yapılandırın.

Gerekli değişkenleri dışarı aktarın:

export RESOURCE_GROUP="<your-resource-group>"
export AKS_CLUSTER="<your-aks-cluster-name>"
export LOCATION="<your-aks-cluster-location>"
export BLOB_STORAGE_NAME="<your-storage-account-name>"

export BLOB_STORAGE_CONTAINER="pyroscope-blob-storage"
export PYROSCOPE_IDENTITY="pyroscope-id"
export PYROSCOPE_SERVICE_ACCOUNT="pyroscope-sa"
export PYROSCOPE_FEDERATED_CREDS="pyroscope-federated-creds"

Depolama hesabını ve kapsayıcıyı oluşturma

az storage account create \
  --name "$BLOB_STORAGE_NAME" \
  --resource-group "$RESOURCE_GROUP" \
  --location "$LOCATION" \
  --sku Standard_ZRS \
  --kind StorageV2 \
  --min-tls-version TLS1_2 \
  --allow-blob-public-access false \
  --output none

az storage container create \
  --name "$BLOB_STORAGE_CONTAINER" \
  --account-name "$BLOB_STORAGE_NAME" \
  --auth-mode login \
  --output none

Yönetilen kimlik oluşturun ve depolama hesabına erişim verin

az identity create \
  --name "$PYROSCOPE_IDENTITY" \
  --resource-group "$RESOURCE_GROUP" \
  --location "$LOCATION" \
  --output none

IDENTITY_CLIENT_ID=$(az identity show \
  --name "$PYROSCOPE_IDENTITY" \
  --resource-group "$RESOURCE_GROUP" \
  --query 'clientId' \
  --output tsv)

SUBSCRIPTION_ID=$(az account show --query id --output tsv)

# Restrict the role assignment scope to the storage account.
STORAGE_SCOPE="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Storage/storageAccounts/${BLOB_STORAGE_NAME}"

az role assignment create \
  --assignee "$IDENTITY_CLIENT_ID" \
  --role "Storage Blob Data Contributor" \
  --scope "$STORAGE_SCOPE" \
  --output none

İş yükü kimliğini etkinleştirme ve federasyon kimlik bilgileri oluşturma

az aks update \
  --name "$AKS_CLUSTER" \
  --resource-group "$RESOURCE_GROUP" \
  --enable-oidc-issuer \
  --enable-workload-identity \
  --output none

OIDC_ISSUER=$(az aks show \
  --name "$AKS_CLUSTER" \
  --resource-group "$RESOURCE_GROUP" \
  --query 'oidcIssuerProfile.issuerUrl' \
  --output tsv)

az identity federated-credential create \
  --name "$PYROSCOPE_FEDERATED_CREDS" \
  --identity-name "$PYROSCOPE_IDENTITY" \
  --resource-group "$RESOURCE_GROUP" \
  --issuer "$OIDC_ISSUER" \
  --subject "system:serviceaccount:gadget:${PYROSCOPE_SERVICE_ACCOUNT}" \
  --audiences "api://AzureADTokenExchange" \
  --output none

Important

Federasyon kimlik bilgisi konu başlığındaki hizmet hesabı adı, Pyroscope Helm sürümü tarafından kullanılan hizmet hesabı adıyla eşleşmelidir. Aksi takdirde, Pyroscope Azure Blob Depolama için kimlik doğrulaması yapamaz.

Pyroscope'u Azure Blob Depolama arka ucu olarak dağıtma

Pyroscope ile profil görselleştirmesini etkinleştir'deki Helm komutu yerine aşağıdaki komutu çalıştırın. Bu yapılandırma Azure Blob Depolama kullanır, hizmet hesabını oluşturur ve Pyroscope pod'da iş yükü kimliğini etkinleştirir.

helm install pyroscope -n gadget \
  oci://ghcr.io/grafana/helm-charts/pyroscope \
  --version 1.15.0 \
  --set pyroscope.image.repository=grafana/pyroscope \
  --set-string pyroscope.image.tag=1.15.0 \
  --set pyroscope.replicaCount=1 \
  --set pyroscope.structuredConfig.self_profiling.disable_push=true \
  --set pyroscope.structuredConfig.storage.backend=azure \
  --set-string pyroscope.structuredConfig.storage.azure.account_name="$BLOB_STORAGE_NAME" \
  --set-string pyroscope.structuredConfig.storage.azure.container_name="$BLOB_STORAGE_CONTAINER" \
  --set pyroscope.serviceAccount.create=true \
  --set-string pyroscope.serviceAccount.name="$PYROSCOPE_SERVICE_ACCOUNT" \
  --set-string pyroscope.serviceAccount.annotations."azure\.workload\.identity/client-id"="$IDENTITY_CLIENT_ID" \
  --set-string pyroscope.podLabels."azure\.workload\.identity/use"=true \
  --set pyroscope.service.type=LoadBalancer \
  --set pyroscope.service.port=4040 \
  --set-string pyroscope.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true \
  --set-string pyroscope.service.annotations."service\.beta\.kubernetes\.io/azure-pls-create"=true \
  --set-string pyroscope.service.annotations."service\.beta\.kubernetes\.io/azure-pls-name"=pyroscope-pls \
  --set-string pyroscope.service.annotations."service\.beta\.kubernetes\.io/azure-pls-proxy-protocol"=false \
  --set-string pyroscope.service.annotations."service\.beta\.kubernetes\.io/azure-pls-visibility"='*' \
  --set alloy.enabled=false \
  --set minio.enabled=false

Pod'un çalıştığını doğrulayın:

kubectl get pods -n gadget pyroscope-0

Pyroscope'u Azure Managed Grafana bağlama ile devam edin.

Note

Helm değer anahtarları grafik sürümleri arasında değişebilir. Sürümünüz için kullanılabilir anahtarları onaylamak için komutunu çalıştırın helm show values oci://ghcr.io/grafana/helm-charts/pyroscope --version 1.15.0.