Skip to content

Commit db888cd

Browse files
bene2k1nerda-codesjcirinosclwy
authored
docs(k8s): add observability docs (#4290)
* docs(k8s): add observability docs * Apply suggestions from code review Co-authored-by: Néda <[email protected]> * Apply suggestions from code review Co-authored-by: Jessica <[email protected]> * Apply suggestions from code review * feat(k8s): update docs * fix(k8s): fix wording * fix(k8s): update requirements --------- Co-authored-by: Néda <[email protected]> Co-authored-by: Jessica <[email protected]>
1 parent a24ead6 commit db888cd

File tree

4 files changed

+192
-1
lines changed

4 files changed

+192
-1
lines changed

menu/navigation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,10 @@
17661766
"label": "Monitor a Kapsule cluster with Cockpit",
17671767
"slug": "monitor-cluster"
17681768
},
1769+
{
1770+
"label": "Monitor a cluster's data plane with Cockpit",
1771+
"slug": "monitor-data-plane-with-cockpit"
1772+
},
17691773
{
17701774
"label": "Access the Kubernetes audit logs",
17711775
"slug": "access-audit-logs"

pages/kubernetes/how-to/access-kubernetes-dashboard.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ content:
77
paragraph: This page explains how to access the dashboard of your Scaleway Kubernetes Kapsule cluster
88
tags: kubernetes kubernetes-kapsule kapsule cluster
99
dates:
10-
validation: 2024-08-12
10+
validation: 2025-01-27
1111
posted: 2020-10-14
1212
categories:
1313
- kubernetes
@@ -26,4 +26,8 @@ categories:
2626
3. Click **Dashboard**. You are taken to your cluster's Kubernetes dashboard.
2727
Here, you can troubleshoot your containerized application, manage the cluster resources, get an overview of applications running on your cluster, and create or modify certain resources.
2828

29+
<Message type="note">
30+
The Kubernetes dashboard offers insights into your cluster's workloads, applications, and individual resource metrics. Unlike Cockpit's control plane dashboards, this dashboard focuses more on operational details within your data plane such as the nodes and workloads running in your cluster.
2931

32+
For advanced observability of your Kubernetes Kapsule data plane, refer to the [How to monitor your Kubernetes Kapsule data plane with Cockpit](/kubernetes/how-to/monitor-data-plane-with-cockpit/) documentation.
33+
</Message>

pages/kubernetes/how-to/monitor-cluster.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ Grafana's rich visualizations and ease of use make it an ideal choice. Cockpit o
2323
* Get new insights on control plane and worker nodes usage such as CPU and memory to optimize your resource allocation
2424
* Achieve a better understanding of your infrastructure by analyzing data on your API server, system applications and up/down scaling behavior
2525

26+
<Message type="important">
27+
**Control Plane monitoring**: Scaleway Kapsule natively provides monitoring for the control plane, free of charge. Additionally, monitoring of the data plane is possible. To monitor the data plane, refer to [How to monitor your Kubernetes Kapsule data plane with Cockpit](/kubernetes/how-to/monitor-data-plane-with-cockpit/). For detailed observability, refer to the [documentation on how to send logs from your Kubernetes cluster to your Cockpit](/cockpit/how-to/send-log-from-k8s-to-cockpit/).
28+
29+
**Control plane vs. data plane**: The control plane is responsible for managing the Kubernetes cluster’s state and orchestrating workloads, while the data plane consists of the nodes that execute the workloads.
30+
31+
**Security and compliance**: For enhanced security and compliance, Kapsule provides audit logs natively within Cockpit. Learn more in the [audit logs documentation](/kubernetes/how-to/access-audit-logs/).
32+
</Message>
33+
2634
<Macro id="requirements" />
2735

2836
- A Scaleway account logged into the [console](https://console.scaleway.com)
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
meta:
3+
title: How to monitor your Kubernetes Kapsule cluster with Cockpit using Promtail
4+
description: This page explains how to integrate Kubernetes container logs with Scaleway Cockpit using Promtail
5+
content:
6+
h1: How to monitor your Kubernetes Kapsule cluster with Cockpit using Promtail
7+
paragraph: This page explains how to integrate Kubernetes container logs with Scaleway Cockpit using Promtail
8+
categories:
9+
- iot-hub
10+
tags: kubernetes kapsule kosmos cockpit promtail logs
11+
dates:
12+
validation: 2025-01-27
13+
posted: 2025-01-17
14+
---
15+
16+
You can now send **data plane** logs from your [Kapsule or Kosmos](https://www.scaleway.com/en/kubernetes) clusters to [Cockpit](https://www.scaleway.com/en/cockpit/), providing centralized, real-time access to application and system logs. Reduce complexity and manual work thanks to this integration, powered by a **Promtail** deployment via [Easy Deploy](/kubernetes/how-to/enable-easy-deploy/).
17+
18+
This feature allows you to:
19+
20+
- **Enhance observability**: View logs from all your Kubernetes containers in one place.
21+
- **Simplify troubleshooting**: Quickly drill down into specific pods or containers without needing to configure a separate logging stack.
22+
23+
<Message type="important">
24+
This feature does incur costs based on the volume of logs ingested. Refer to [Cockpit FAQ](/faq/cockpit/#how-am-i-billed-for-using-cockpit-with-custom-data) for more details and best practices to avoid unexpected bills.
25+
</Message>
26+
27+
<Macro id="requirements" />
28+
29+
- A running [Kapsule](/kubernetes/how-to/create-cluster/) or [Kosmos](/kubernetes/how-to/create-kosmos-cluster/) cluster.
30+
- An API Key with [IAM permissions](/iam/reference-content/permission-sets/) to:
31+
- edit your cluster `(KubernetesFullAccess` or `KubernetesSystemMastersGroupAccess`)
32+
- write on Cockpit (`ObservabilityFullAccess`)
33+
- [A token](/cockpit/how-to/create-token/) with permissions to push to, and query logs from Cockpit
34+
35+
## Architecture and limitations
36+
37+
### Control plane vs. data plane
38+
39+
- **Control plane**: Fully managed by Scaleway. Users can already [monitor control plane components](/kubernetes/how-to/monitor-cluster/) (e.g., `kube-apiserver`, `CCM`, `CSI`) via Cockpit.
40+
- **Data plane**: Runs in your Scaleway Project (customer-managed instances, `kubelet`, `containerd`, customer Pods, etc.). You have **full access** to the data plane, including the ability to SSH into nodes.
41+
42+
| Feature | Control plane | Data plane |
43+
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
44+
| Responsibility | Fully managed by Scaleway | Managed by the customer (runs in your Scaleway Project) |
45+
| Components | `kube-apiserver`, `CCM`, `CSI`, etc. | `kubelet`, `containerd`, customer Pods, and system components like `kubelet.service`. |
46+
| Access | Users can monitor components via Cockpit ([see how-to guide](/kubernetes/how-to/monitor-cluster/)) | Full access to data, including SSH into nodes, log management, and custom configurations. |
47+
| Billing | Included in cluster costs | Billed based on log ingestion volume (see pricing below). |
48+
49+
Because the data plane is entirely under your control, **logs from any components running on these nodes are considered your own data**. Consequently, shipping these logs to Cockpit is billed based on data ingestion.
50+
51+
## How it works
52+
53+
The system leverages **Promtail** (a lightweight log collector) running on your Kapsule or Kosmos cluster. Promtail forwards logs to the Loki endpoint of your Cockpit instance:
54+
55+
1. **Promtail** can collect logs from:
56+
- **Container stdout/stderr** (pods)
57+
- **systemd journal** (e.g., `kubelet.service`)
58+
2. The app automatically creates a custom datasource called `kubernetes-logs` and a Cockpit token with push logs permission.
59+
3. **Log data** is transmitted to **Cockpit** (Loki).
60+
4. **Cockpit** stores and indexes these logs.
61+
62+
## Step-by-step: Enabling container logs in Cockpit
63+
64+
You can use Scaleway’s **[Easy Deploy](/kubernetes/how-to/enable-easy-deploy/)** to add a Promtail deployment to your cluster:
65+
66+
1. Log in to the [Scaleway console](https://console.scaleway.com/) and go to your **Kubernetes** cluster.
67+
2. Navigate to the **Easy Deploy** tab.
68+
3. Select **Promtail for Cockpit** from the library.
69+
4. **Deploy** the application. Promtail will install on your cluster with default settings that:
70+
- Collect container logs for **all namespaces** (by default).
71+
- Collect systemd journal logs (e.g., `kubelet.service`).
72+
- Forward logs securely to **Cockpit**.
73+
<Message type="note">
74+
You can edit the default deployment configuration to filter logs by source (under `config.snippets.scrapeConfigs` in the YAML file). For example:
75+
```yaml
76+
cockpit_promtail_scrape_config_pods: "namespace1,namespace2"
77+
cockpit_promtail_scrape_config_journal: "kubelet.service,kube-proxy.service"
78+
```
79+
</Message>
80+
81+
### Example Promtail configuration
82+
Below is a simplified snippet of the configuration that Easy Deploy generates by default:
83+
```yaml
84+
config:
85+
clients:
86+
- bearer_token: "{{{ cockpit_bearer_token }}}" # Automatically set by Easy Deploy
87+
url: "{{{ cockpit_loki_push_url }}}" # Automatically set by Easy Deploy
88+
89+
snippets:
90+
scrapeConfigs: |
91+
{{{- cockpit_promtail_scrape_config_pods }}} # Default: log all pods
92+
{{{- cockpit_promtail_scrape_config_journal }}} # Default: log all system components
93+
extraVolumeMounts:
94+
- mountPath: /var/log/journal
95+
name: journal
96+
readOnly: true
97+
extraVolumes:
98+
- hostPath:
99+
path: /var/log/journal
100+
name: journal
101+
```
102+
<Message type="note">
103+
Template values like `{{{ cockpit_bearer_token }}}` (Bearer Token) and `{{{ cockpit_loki_push_url }}}` (Loki URL) are automatically set. Avoid modifying these values.
104+
</Message>
105+
106+
## Visualizing logs in Cockpit
107+
108+
Once Promtail is running:
109+
110+
1. Go to the **Cockpit** section of the Scaleway console, then click **Open dashboards**.
111+
2. Log into Grafana using your [Cockpit credentials](/cockpit/how-to/retrieve-grafana-credentials/).
112+
3. In Grafana's menu, go to dashboards and select **Kubernetes Cluster Pod Log**.
113+
4. **Filter** by:
114+
- `Datasource` which is automatically created upon deployment, and visible in the Cockpit console
115+
- `Cluster Name` ( e.g. `my-kapsule-cluster`)
116+
- `namespace`, `pod`, or `container` labels to isolate specific workloads
117+
- **Time range** to limit how far back in history you want to query
118+
5. **Analyze** logs in real-time or historical mode to troubleshoot issues, watch for errors, or track performance.
119+
120+
## Usage and pricing
121+
122+
Sending logs to Cockpit is billed based on the **total volume of logs ingested**. Learn more about how you are billed for using Cockpit with Scaleway data [in the Cockpit FAQ](/faq/cockpit/#how-am-i-billed-for-using-cockpit-with-my-scaleway-data).
123+
124+
Key points include:
125+
126+
- **Logging rate**: The more logs you produce (e.g. high-traffic workloads or verbose logging), the higher the bill.
127+
- **Filtering**: Limit logs to critical namespaces or system components only.
128+
129+
<Message type="note">
130+
You may edit the default configuration of the deployment to adjust the volume of logs to ingest:
131+
```yaml
132+
extraLimitsConfig: |
133+
readline_rate_enabled: true # rate limiting
134+
readline_rate: 10000 # log lines / sec
135+
readline_burst: 10000 # cap for burst lines
136+
readline_rate_drop: true # drop excess lines
137+
```
138+
139+
</Message>
140+
141+
<Message type="tip">
142+
Always monitor the logs ingestion rate in the dedicated dashboards provided in Cockpit to avoid surprises.
143+
</Message>
144+
145+
## Security considerations
146+
147+
- **Authentication**: The Promtail client uses a Cockpit Bearer Token to authenticate. Keep this token secret; do not store it in publicly accessible repos.
148+
- **Encryption**: Communication between Promtail and Cockpit (HTTPS) encrypts logs in transit.
149+
- **Access Control**: Ensure only trusted team members can deploy Easy Deploy applications or modify cluster-level configurations.
150+
151+
## Troubleshooting
152+
153+
- **No logs appearing** in Cockpit:
154+
- Verify that the Promtail pod is running.
155+
```bash
156+
kubectl get pods -n <promtail-namespace>
157+
```
158+
- Inspect Promtail logs for errors.
159+
```bash
160+
kubectl logs <promtail-pod-name> -n <promtail-namespace>
161+
```
162+
163+
- **High log ingestion cost**:
164+
- Review your **deployment configuration** to filter out verbose logs or unneeded namespaces.
165+
- Check **log ingestion rate** in the dedicated dashboards for unusual spikes.
166+
167+
## Further resources
168+
169+
- [Observability Cockpit Overview](/cockpit/)
170+
- [Push logs to Cockpit (How-To)](/cockpit/how-to/send-metrics-logs-to-cockpit/)
171+
- [Send logs from your Kubernetes cluster to your Cockpit (How-To)](/cockpit/how-to/send-log-from-k8s-to-cockpit/)
172+
- [Send metrics from your Kubernetes cluster to your Cockpit (How-To)](/cockpit/how-to/send-metrics-from-k8s-to-cockpit/)
173+
- [Promtail Documentation](https://grafana.com/docs/loki/latest/clients/promtail/)
174+
- [Scaleway Kapsule Documentation](/kubernetes/kapsule/quickstart/)
175+
- [Scaleway Kosmos Documentation](/kubernetes/kosmos/quickstart/)

0 commit comments

Comments
 (0)