Learn how to use Azure Kubernetes Service Diagnostics
Tags: azure, kubernetes
Published: 2020-06-12 13:00:11

---
title: Learn how to use Azure Kubernetes Service Diagnostics
published: true
description: Learn how to easily use Azure Kubernetes Service Diagnostics
tags: azure, kubernetes
//cover_image: https://direct_url_to_image.jpg
---

[Azure Kubernetes Service (AKS)](https://docs.microsoft.com/azure/aks/intro-kubernetes?WT.mc_id=docs-azuredevtips-micrum) enables you to run multiple containers and orchestrate them by scaling them, securing them and tying them together. A solution that runs inside a Kubernetes cluster can quickly become complex. This makes it more difficult to pinpoint issues and resolve them quickly.

The [Diagnostics overview](https://docs.microsoft.com/azure/aks/concepts-diagnostics?WT.mc_id=docs-azuredevtips-micrum) in Azure Kubernetes Service can help you to identify, diagnose and resolve issues in your Kubernetes cluster. In this post, we'll take a look at what the Diagnostics overview can do for us. 

#### Prerequisites

If you want to follow along, you'll need the following:
* An Azure subscription (If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=azure-azuredevtips-micrum) before you begin)
* A running Azure Kubernetes Service (AKS) cluster that runs an application in one or more nodes. You can set one up by following [this walkthrough.](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough?WT.mc_id=docs-azuredevtips-micrum)
* The [Azure CLI](https://docs.microsoft.com/cli/azure/?WT.mc_id=docs-azuredevtips-micrum). You can [download it for Windows, Linux or Mac](https://docs.microsoft.com/cli/azure/install-azure-cli?WT.mc_id=docs-azuredevtips-micrum). Or you can use the [Azure Cloud Shell](https://shell.azure.com/?WT.mc_id=azure-azuredevtips-micrum)

#### Using Azure Kubernetes Service Diagnostics

Let's try it out. I have a Kubernetes cluster running in Azure that is running a sample application. I've deployed it by following the steps in [this walkthrough.](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough?WT.mc_id=docs-azuredevtips-micrum)

It should be ready to go. It has a frontend node and I can check how to reach it with the [Azure CLI](https://docs.microsoft.com/cli/azure/?WT.mc_id=docs-azuredevtips-micrum) (or [Azure Cloud Shell](https://shell.azure.com/?WT.mc_id=azure-azuredevtips-micrum)) with the **kubectl get service** command.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nw31yorc2cyiywh4vm66.png)

(Check AKS service endpoints)

But when I try to open the azure-vote-front service in a browser, it doesn't work and shows an error.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0qmc4ypq8wmzyv4qtbdy.png)

(Service doesn't work and shows an error)

Let's find out why this isn't working.
1. Go to the [Azure portal](https://portal.azure.com/?WT.mc_id=azure-azuredevtips-micrum)
2. Open the Azure Kubernetes Service cluster
3. Navigate to the **Diagnose and solve problems** menu

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/45wt1eigyebxljqu083o.png)

(Diagnose and solve problems menu in AKS)

Here, you can search for keywords, like "Failures", or describe the problem. Click on the search textbox to see some examples of what you can search for and diagnose. You can see the entire list of issues that can be diagnosed [here](https://docs.microsoft.com/azure/aks/concepts-diagnostics?WT.mc_id=docs-azuredevtips-micrum). Let's click on **Failures** to see if we can find out what went wrong. This shows that there are issues with one or more Nodes. Click on the issues to drill down into them. In my case, the issue is that my Node has been powered off and it needs to be restarted.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/837dlbsl6wo05lbskkbd.png)

(Node issues in the Diagnose and resolve problems feature)

I need to upgrade my cluster anyways, so I'll do just that. This will automatically restart my nodes as well and probably solve the issue. I upgrade my cluster by navigating to the **Upgrade menu**, selecting the latest version and saving the changes. This takes a while.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gfswjvgh94n4rir7718n.png)

(Upgrade cluster restarts nodes)

When my cluster is upgraded, my nodes are restarted. Let's try to use the service again in the browser. The application loads successfully. 


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/loenkrnto3rxixyglxxt.png)

(Service works after node restart)

#### Conclusion

Diagnosing issues in [Azure Kubernetes Service (AKS)](https://docs.microsoft.com/azure/aks/intro-kubernetes?WT.mc_id=docs-azuredevtips-micrum) is now a lot easier with [Azure Kubernetes Service (AKS) Diagnostics](https://docs.microsoft.com/azure/aks/concepts-diagnostics?WT.mc_id=docs-azuredevtips-micrum). You can ask the intelligent diagnostics feature what you want it to investigate and it will tell you if anything is wrong and what the issues are and how to resolve them. 

Stay connected with me on various social platforms for daily software development news.

- [Twitter](https://twitter.com/intent/follow?screen_name=mbcrump) | [Twitch](https://twitch.tv/mbcrump) | [Instagram](https://instagram.com/mbcrump) | [YouTube](https://youtube.com/mbcrump) | [GitHub](https://github.com/mbcrump) | [Website](https://www.michaelcrump.net)