如何实时查看部署(预览版)How to view Deployments (preview) in real-time

在适用于容器的 Azure Monitor 中,查看部署(预览版)功能通过公开 kubeclt get deploymentskubectl describe deployment {your deployment} 命令实时模拟对 Kubernetes 部署对象的直接访问。With Azure Monitor for containers, the view Deployments (preview) feature emulates direct access to Kubernetes Deployment objects in real time by exposing the kubeclt get deployments and kubectl describe deployment {your deployment} commands.

备注

此功能不支持以专用群集形式启用的 AKS 群集。AKS clusters enabled as private clusters are not supported with this feature. 此功能依赖于从浏览器通过代理服务器直接访问 Kubernetes API。This feature relies on directly accessing the Kubernetes API through a proxy server from your browser. 启用网络安全以阻止来自此代理的 Kubernetes API 阻止此流量。Enabling networking security to block the Kubernetes API from this proxy will block this traffic.

若要了解详细信息,请查看有关部署的 Kubernetes 文档。To learn more, review the Kubernetes documentation about Deployments.

工作原理How it works

实时数据(预览版)功能可直接访问 Kubernetes API;有关身份验证模型的其他信息,请参阅此处The Live Data (preview) feature directly access the Kubernetes API, and additional information about the authentication model can be found here.

部署(预览版)功能对部署终结点 /apis/apps/v1/deployments 执行一次(可刷新)加载。The Deployments (preview) feature performs a one time (refreshable) load against the deployments endpoint /apis/apps/v1/deployments. 它允许你选择给定的部署,并针对部署终结点 /apis/apps/v1/namespaces/${nameSpace}/deployments/${deploymentName} 加载针对该特定部署的说明详细信息。It allows you to select a given deployment and load the describe details for that specific deployment against the deployment endpoint /apis/apps/v1/namespaces/${nameSpace}/deployments/${deploymentName}.

选择页面左上角的“刷新”将刷新部署列表。Selecting Refresh in the top left of the page refreshes the deployment list. 这会模拟重新运行 kubectl 命令。This simulates re-running the kubectl command.

重要

此功能运行期间不会永久存储任何数据。No data is stored permanently during operation of this feature. 当你关闭或离开浏览器时,将删除在此会话期间捕获的所有信息。All information captured during the session is deleted when you close your browser or navigate away from it.

备注

不能将实时数据(预览版)数据从控制台固定到 Azure 仪表板。You cannot pin Live Data (Preview) data from the console to an Azure dashboard.

部署描述Deployments describe

若要查看部署的描述详细信息(与 kubectl describe deployment 等效),请执行以下步骤。To view Describe details for a deployment, which is the equivalent to kubectl describe deployment, perform the following steps.

  1. 在 Azure 门户中,浏览到 AKS 群集资源组,然后选择 AKS 资源。In the Azure portal, browse to the AKS cluster resource group and select your AKS resource.

  2. 在 AKS 群集仪表板上,在左侧的“监视”下,选择“见解” 。On the AKS cluster dashboard, under Monitoring on the left-hand side, choose Insights.

  3. 选择“部署(预览版)”选项卡。Select the Deployments (preview) tab.

    Azure 门户中的部署视图

此视图显示所有正在运行的部署的列表,以及命名空间和其他详细信息,模拟了 kubectl get deployments -all-namespaces 命令的执行。The view shows a list of all the running deployments along with the namespace and other detailed information, emulating execution of the command kubectl get deployments -all-namespaces. 可以通过选择任何一列对结果进行排序。You can sort the results by selecting any one of the columns.

部署属性窗格详细信息

从列表中选择部署时,页面右侧将自动显示属性窗格。When you select a deployment from the list, a property pane automatically displays on the right side of the page. 其中显示了在运行 kubectl describe deployment {deploymentName} 命令时将看到的已选部署的相关信息。It shows information related to the selected deployment that you would view if you ran the command kubectl describe deployment {deploymentName}. 你可能已注意到描述信息缺少一些详细信息。You may have noticed that the describe information is missing some details. 最明显的是缺少模板。Most notably the Template is missing. 选择“原始”选项卡可以导航到未分析的描述详细信息。Selecting the Raw tab allows you to navigate to the un-parsed Describe details.

部署属性窗格原始详细信息

查看部署详细信息时,可以实时查看容器日志和事件。While you review deployment details, you can see container logs and events in real time. 选择“查看实时控制台”,实时数据(预览版)控制台窗格将显示在部署数据网格下,你可以在其中查看连续流中的实时日志数据。Select the View live console and the Live Data (preview) console pane will appear below the deployments data grid where you can view live log data in a continuous stream. 如果提取状态指示器显示绿色复选标记(位于窗格最右侧),则表示可以检索数据并开始将其流式传输到控制台。If the fetch status indicator shows a green check mark, which is on the far right of the pane, it means data can be retrieved and it begins streaming to your console.

还可以按命名空间或群集级别事件进行筛选。You can also filter by namespace or cluster level events. 若要了解有关在控制台中实时查看数据的详细信息,请参阅使用适用于容器的 Azure Monitor 查看实时数据(预览版)To learn more about the viewing data real-time in the console, see View Live Data (preview) with Azure Monitor for containers.

在控制台中查看实时数据的部署

后续步骤Next steps