Kueri untuk tabel KubePodInventory
Untuk informasi tentang menggunakan kueri ini di portal Azure, lihat tutorial Analitik Log. Untuk REST API, lihat Kueri.
Pod dalam perulangan crash
Menentukan apakah Pod/Kontainer memiliki fase Crash-Loop.
//Determines whether Pods/Containers has Crash-Loop phase
KubePodInventory
| where ContainerStatus == 'waiting'
| where ContainerStatusReason == 'CrashLoopBackOff' or ContainerStatusReason == 'Error'
| extend ContainerLastStatus=todynamic(ContainerLastStatus)
| summarize RestartCount = arg_max(ContainerRestartCount, Computer, Namespace, ContainerLastStatus.reason) by Name
Pod dalam status tertunda
Periksa Pod yang tidak dapat dimulai dan waktunya tertunda.
//Check Pods that cannot be started and its pending time
KubePodInventory
| where PodStatus == 'Pending'
| project PodCreationTimeStamp, Namespace, PodStartTime, PodStatus, Name, ContainerStatus
| summarize Start = any(PodCreationTimeStamp), arg_max(PodStartTime, Namespace) by Name
| extend PodStartTime = iff(isnull(PodStartTime), now(), PodStartTime)
| extend PendingTime = PodStartTime - Start
| project Name, Namespace ,PendingTime
Temukan Di KubePodInventory
Temukan di KubePodInventory untuk mencari nilai tertentu dalam tabel KubePodInventory./nNote bahwa kueri ini memerlukan pembaruan <parameter SeachValue> untuk menghasilkan hasil
// This query requires a parameter to run. Enter value in SearchValue to find in table.
let SearchValue = "<SearchValue>";//Please update term you would like to find in the table.
KubePodInventory
| where * contains tostring(SearchValue)
| take 1000