Skip to content

Commit 8fac9c7

Browse files
Revert "Removed the Network Observability CLI files"
This reverts commit a846437.
1 parent a846437 commit 8fac9c7

File tree

2 files changed

+521
-0
lines changed

2 files changed

+521
-0
lines changed
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
---
2+
title: "Setup of Network Observability for Azure Kubernetes Service (AKS) - BYO Prometheus and Grafana"
3+
description: Get started with AKS Network Observability for your AKS cluster using BYO Prometheus and Grafana.
4+
author: asudbring
5+
ms.author: allensu
6+
ms.service: azure-kubernetes-service
7+
ms.subservice: aks-networking
8+
ms.topic: how-to
9+
ms.date: 06/20/2023
10+
ms.custom: template-how-to-pattern, devx-track-azurecli
11+
---
12+
13+
# Setup of Network Observability for Azure Kubernetes Service (AKS) - BYO Prometheus and Grafana
14+
15+
AKS Network Observability is used to collect the network traffic data of your AKS cluster. Network Observability enables a centralized platform for monitoring application and network health. Prometheus collects AKS Network Observability metrics, and Grafana visualizes them. Both Cilium and non-Cilium data plane are supported. In this article, learn how to enable the Network Observability add-on and use BYO Prometheus and Grafana to visualize the scraped metrics.
16+
17+
> [!NOTE]
18+
>Starting with Kubernetes version 1.29, the network observability feature no longer supports Bring Your Own (BYO) Prometheus and Grafana. However, you can still enable it using the Azure Managed Prometheus and Grafana offering
19+
>
20+
21+
> [!IMPORTANT]
22+
> AKS Network Observability is currently in PREVIEW.
23+
> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
24+
25+
For more information about AKS Network Observability, see [What is Azure Kubernetes Service (AKS) Network Observability?](network-observability-overview.md).
26+
27+
## Prerequisites
28+
29+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
30+
31+
- Installations of BYO Prometheus and Grafana.
32+
33+
[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
34+
35+
- Minimum version of **Azure CLI** required for the steps in this article is **2.44.0**. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
36+
37+
### Install the `aks-preview` Azure CLI extension
38+
39+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
40+
41+
```azurecli-interactive
42+
# Install the aks-preview extension
43+
az extension add --name aks-preview
44+
45+
# Update the extension to make sure you have the latest version installed
46+
az extension update --name aks-preview
47+
```
48+
49+
### Register the `NetworkObservabilityPreview` feature flag
50+
51+
```azurecli-interactive
52+
az feature register --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview"
53+
```
54+
55+
Use [az feature show](/cli/azure/feature#az-feature-show) to check the registration status of the feature flag:
56+
57+
```azurecli-interactive
58+
az feature show --namespace "Microsoft.ContainerService" --name "NetworkObservabilityPreview"
59+
```
60+
61+
Wait for the feature to say **Registered** before preceding with the article.
62+
63+
```output
64+
{
65+
"id": "/subscriptions/23250d6d-28f0-41dd-9776-61fc80805b6e/providers/Microsoft.Features/providers/Microsoft.ContainerService/features/NetworkObservabilityPreview",
66+
"name": "Microsoft.ContainerService/NetworkObservabilityPreview",
67+
"properties": {
68+
"state": "Registering"
69+
},
70+
"type": "Microsoft.Features/providers/features"
71+
}
72+
```
73+
When the feature is registered, refresh the registration of the Microsoft.ContainerService resource provider with [az provider register](/cli/azure/provider#az-provider-register):
74+
75+
```azurecli-interactive
76+
az provider register -n Microsoft.ContainerService
77+
```
78+
79+
## Create a resource group
80+
81+
A resource group is a logical container into which Azure resources are deployed and managed. Create a resource group with [az group create](/cli/azure/group#az-group-create) command. The following example creates a resource group named **myResourceGroup** in the **eastus** location:
82+
83+
```azurecli-interactive
84+
az group create \
85+
--name myResourceGroup \
86+
--location eastus
87+
```
88+
89+
## Create AKS cluster
90+
91+
Create an AKS cluster with [az aks create](/cli/azure/aks#az-aks-create) command. The following example creates an AKS cluster named **myAKSCluster** in the **myResourceGroup** resource group:
92+
93+
# [**Non-Cilium**](#tab/non-cilium)
94+
95+
Non-Cilium clusters support the enablement of Network Observability on an existing cluster or during the creation of a new cluster.
96+
97+
## New cluster
98+
99+
Use [az aks create](/cli/azure/aks#az-aks-create) in the following example to create an AKS cluster with Network Observability and non-Cilium.
100+
101+
```azurecli-interactive
102+
az aks create \
103+
--name myAKSCluster \
104+
--resource-group myResourceGroup \
105+
--location eastus \
106+
--generate-ssh-keys \
107+
--network-plugin azure \
108+
--network-plugin-mode overlay \
109+
--pod-cidr 192.168.0.0/16 \
110+
--enable-network-observability
111+
```
112+
113+
## Existing cluster
114+
115+
Use [az aks update](/cli/azure/aks#az-aks-update) to enable Network Observability on an existing cluster.
116+
117+
```azurecli-interactive
118+
az aks update \
119+
--resource-group myResourceGroup \
120+
--name myAKSCluster \
121+
--enable-network-observability
122+
```
123+
124+
# [**Cilium**](#tab/cilium)
125+
126+
Use the following example to create an AKS cluster with Network Observability and Cilium.
127+
128+
```azurecli-interactive
129+
az aks create \
130+
--name myAKSCluster \
131+
--resource-group myResourceGroup \
132+
--generate-ssh-keys \
133+
--location eastus \
134+
--max-pods 250 \
135+
--network-plugin azure \
136+
--network-plugin-mode overlay \
137+
--network-dataplane cilium \
138+
--node-count 2 \
139+
--pod-cidr 192.168.0.0/16
140+
```
141+
142+
---
143+
144+
## Get cluster credentials
145+
146+
```azurecli-interactive
147+
az aks get-credentials --name myAKSCluster --resource-group myResourceGroup
148+
```
149+
150+
## Enable Visualization on Grafana
151+
152+
Use the following example to configure scrape jobs on Prometheus and enable visualization on Grafana for your AKS cluster.
153+
154+
155+
# [**Non-Cilium**](#tab/non-cilium)
156+
157+
> [!NOTE]
158+
> The following section requires installations of Prometheus and Grafana.
159+
160+
1. Add the following scrape job to your existing Prometheus configuration and restart your Prometheus server:
161+
162+
```yml
163+
scrape_configs:
164+
- job_name: "network-obs-pods"
165+
kubernetes_sd_configs:
166+
- role: pod
167+
relabel_configs:
168+
- source_labels: [__meta_kubernetes_pod_container_name]
169+
action: keep
170+
regex: kappie(.*)
171+
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
172+
separator: ":"
173+
regex: ([^:]+)(?::\d+)?
174+
target_label: __address__
175+
replacement: ${1}:${2}
176+
action: replace
177+
- source_labels: [__meta_kubernetes_pod_node_name]
178+
action: replace
179+
target_label: instance
180+
metric_relabel_configs:
181+
- source_labels: [__name__]
182+
action: keep
183+
regex: (.*)
184+
```
185+
186+
1. In **Targets** of Prometheus, verify the **network-obs-pods** are present.
187+
188+
1. Sign in to Grafana and import Network Observability dashboard with ID [18814](https://grafana.com/grafana/dashboards/18814/).
189+
190+
# [**Cilium**](#tab/cilium)
191+
192+
> [!NOTE]
193+
> The following section requires installations of Prometheus and Grafana.
194+
195+
1. Add the following scrape job to your existing Prometheus configuration and restart your prometheus server.
196+
197+
```yml
198+
scrape_configs:
199+
- job_name: 'kubernetes-pods'
200+
kubernetes_sd_configs:
201+
- role: pod
202+
relabel_configs:
203+
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
204+
action: keep
205+
regex: true
206+
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
207+
action: replace
208+
regex: (.+):(?:\d+);(\d+)
209+
replacement: ${1}:${2}
210+
target_label: __address__
211+
```
212+
213+
1. In **Targets** of prometheus, verify the **kubernetes-pods** are present.
214+
215+
1. Sign in to Grafana and import dashboards with the following ID [16611-cilium-metrics](https://grafana.com/grafana/dashboards/16611-cilium-metrics/)
216+
217+
---
218+
219+
## Clean up resources
220+
221+
If you're not going to continue to use this application, delete the AKS cluster and the other resources created in this article with the following example:
222+
223+
```azurecli-interactive
224+
az group delete \
225+
--name myResourceGroup
226+
```
227+
228+
## Next steps
229+
230+
In this how-to article, you learned how to install and enable AKS Network Observability for your AKS cluster.
231+
232+
- For more information about AKS Network Observability, see [What is Azure Kubernetes Service (AKS) Network Observability?](network-observability-overview.md).
233+
234+
- To create an AKS cluster with Network Observability and managed Prometheus and Grafana, see [Setup Network Observability for Azure Kubernetes Service (AKS) Azure managed Prometheus and Grafana](network-observability-managed-cli.md).
235+

0 commit comments

Comments
 (0)