View logs to collect and review data in AKS on Azure Stack HCI

Logs present an important means to collect and review data from multiple sources and provide insights into the general condition of your environment. They are helpful when troubleshooting user application and services, as the user may need to view the logs generated by different AKS on Azure Stack HCI components determine possible points of failure when an issue arises. This topic presents different useful log data that enables debugging of issues and also details some AKS on Azure Stack HCI and kubectl commands to view these logs.

Use PowerShell commands to view logs

To get logs from your all your pods, run the Get-AksHciLogs PowerShell command. This command will create an output zipped folder called akshcilogs.zip in your AKS on Azure Stack HCI working directory.

The following Get-AksHciLogs parameters describe how you can use the command to view logs and collect data:

  • Get-AksHciLogs -AgentLogs: Add this parameter to get the logs from the Microsoft On-premises Cloud (MOC) stack cloud agent and the node agent services. The output of the command is located in the \akshcilogs folder of your AKS on Azure Stack HCI working directory.

  • Get-AksHciLog -EventLogs: Use this parameter to get event logs that are logged to the event viewer.

  • Get-AksHciLogs -VirtualMachineLogs: Use this parameter to get the logs from the guest virtual machines created by AKS on Azure Stack HCI.

  • Get-AksHciLogs -KvaLogs: Add this parameter to get the logs from the AKS host.

  • Get-AksHciLogs -DownloadSdkLogs: Use this command to retrieve the download logs that are generated from downloading the binaries and images that AKS on Azure Stack HCI uses.

  • Get-AksHciLogs -BillingRecords: Add this parameter to get the billing records. The output is generally a text document located in the \akshcilogs folder of your working directory and is similar to the output below:

    The image shows an output of running Get-AksHciLogs with the -BillingRecords parameter.

Microsoft On-premises Cloud

Microsoft On-premises Cloud is the management stack that enables virtual machines on Azure Stack HCI or on a Windows Server-based Software-defined data center (SDDC) to be managed in the cloud. Microsoft On-premises Cloud includes the following components:

  • A single instance of a highly available cloud agent service deployed in the cluster. This agent runs on any one node in the Azure Stack HCI cluster and is configured to fail over to another node.
  • A node agent running on every Azure Stack HCI physical node.

Get-MocConfig is a useful debugging tool that provides information such as the cloud configuration, node configuration, certification location of the node and the Microsoft On-premises Cloud. The output from running Get-MocConfig is similar to the following example output:

The image shows an example of output from running Get-Moc-Config.

Kubernetes Virtual Appliance

Kubernetes Virtual Appliance (KVA) is a virtual machine image file that consists of a pre-configured operating system environment and a single application. The purpose of the KVA is to simplify delivery and operation of an application. Consequently, only necessary operating system components are included. The Get-kvaConfig command provides some important details that could help in debugging issues with misconfiguration as shown in the following example output:

The image shows an example of output from running Get-Kva-Config.

Kubectl commands

Kubernetes logs also have useful information about the health of your cluster and applications. Some important ones include the following commands:

  • Kubectl get nodes lists all nodes and provides information about their status, roles, age after creation, and version.
  • Kubectl get pods lists all pods in the namespace and their status.
  • Kubectl get service lists all services in the namespace.
  • Kubectl get events gives a sequence of timing for activities associated with different kubernetes objects.

Next steps

In this topic, you learned how to view the logs from multiple sources and provide insights into the general condition of your AKS on Azure Stack HCI environment. To monitor and troubleshoot further, you can also view the kubelet logs.