Skip to content

Commit

Permalink
docs(cpt): add images + fix dates (#4263)
Browse files Browse the repository at this point in the history
  • Loading branch information
nerda-codes authored Jan 21, 2025
1 parent 8a37684 commit ec49aa6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 74 deletions.
8 changes: 8 additions & 0 deletions menu/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3558,6 +3558,14 @@
"label": "Send metrics to Cockpit using Grafana Alloy",
"slug": "send-metrics-with-grafana-alloy"
},
{
"label": "Send metrics from your Kubernetes cluster to Cockpit",
"slug": "send-metrics-from-k8s-to-cockpit"
},
{
"label": "Send logs from your Kubernetes cluster to Cockpit",
"slug": "send-logs-from-k8s-to-cockpit"
},
{
"label": "Send metrics and logs to your Cockpit",
"slug": "send-metrics-logs-to-cockpit"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ tags: kubernetes cockpit logs observability monitoring cluster
categories:
- observability
dates:
validation: 2025/01/20
posted: 2025/01/20
validation: 2025-01-20
posted: 2025-01-20
---

In this page, we will show you how to send application logs from your Kubernetes cluster to your Cockpit using either a Helm chart or deploying a Helm chart with [Terraform](https://www.terraform.io/).
Expand Down Expand Up @@ -43,14 +43,14 @@ destinations:
- name: "my-cockpit-logs"
type: "loki"
protocol: "http"
logs:
logs:
enabled: true
url: "$COCKPIT_CUSTOM_LOGS_DATASOURCE_URL/loki/api/v1/push" ##You can find your logs URL in the **Data sources** tab of the Scaleway console under the "API URL" section of the relevant data source
tenantId: "$COCKPIT_TOKEN"
metrics:

metrics:
enabled: false
traces:
traces:
enabled: false
clusterEvents:
enabled: true
Expand Down Expand Up @@ -78,7 +78,7 @@ alloy-singleton:
<Message type="note">
The template above is for sending logs to your Cockpit. You can also configure it to send metrics to Cockpit using this Helm chart.
Refer to our dedicated documentation to [send metrics from your cluster to Cockpit](/observability/cockpit/how-to/send-metrics-froms-k8s-to-cockpit).
Refer to our dedicated documentation to [send metrics from your cluster to Cockpit](/observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit).
</Message>
## Send Kubernetes logs using Helm chart
Expand All @@ -87,49 +87,48 @@ Once you have configured your `values.yml` file, you can use Helm to deploy the

1. [Connect](/containers/kubernetes/how-to/connect-cluster-kubectl/) `kubectl` to your Kubernetes cluster
2. Run the command below to install the `k8s-monitoring` Helm chart:
```
helm install -f /your-path/to/values.yml name-of-your-choice-for-your-log-ingester k8s-monitoring --version 1.6.16
```
The `-f` flag specifies the path to your `values.yml` file, which contains the configuration for the Helm chart. Make sure that you replace `/your-path/to/values.yml` with the correct path where your `values.yml` file is stored. Make sure that you also replace `name-of-your-choice-for-your-log-ingester` with a clear name (ex. `alloy-logs-ingester`). In our configuration, we are using `alloy-lm-ingester`.

Helm installs the `k8s-monitoring` chart, which includes the Alloy DaemonSet configured to collect logs from your Kubernetes cluster.
The DaemonSet ensures that a pod is running on each node in your cluster, which collects logs and forwards them to the specified Loki endpoint in your Cockpit.
```
helm install -f /your-path/to/values.yml name-of-your-choice-for-your-log-ingester k8s-monitoring --version 1.6.16
```
The `-f` flag specifies the path to your `values.yml` file, which contains the configuration for the Helm chart. Make sure that you replace `/your-path/to/values.yml` with the correct path where your `values.yml` file is stored. Make sure that you also replace `name-of-your-choice-for-your-log-ingester` with a clear name (ex. `alloy-logs-ingester`). In our configuration, we are using `alloy-lm-ingester`.
Helm installs the `k8s-monitoring` chart, which includes the Alloy DaemonSet configured to collect logs from your Kubernetes cluster.
The DaemonSet ensures that a pod is running on each node in your cluster, which collects logs and forwards them to the specified Loki endpoint in your Cockpit.

3. Optionally, check the status of the release to ensure it was installed:

```
helm list
```
```
helm list
```

## Send Kubernetes logs using Helm chart with Terraform

You can also use Terraform to manage and deploy Helm charts, providing you with more automation and consistency to manage your Kubernetes resources.

1. Create a `provider.tf` file and paste the following template to set up the Helm Terraform provider:
```terraform
provider "helm" {
kubernetes {
host = your_k8s_cluster_host # The URL of your Kubernetes API server.
token = your_k8s_cluster_token # Authentication token to access the cluster.
cluster_ca_certificate = base64decode(
your_k8s_cluster_ca_certificate # The cluster's CA certificate.
)
```terraform
provider "helm" {
kubernetes {
host = your_k8s_cluster_host # The URL of your Kubernetes API server.
token = your_k8s_cluster_token # Authentication token to access the cluster.
cluster_ca_certificate = base64decode(
your_k8s_cluster_ca_certificate # The cluster's CA certificate.
)
}
}
}
```
```
2. Create a `maint.tf` file and paste the following template to create a Helm release resource. Make sure that you replace `/your-path/to/values.yml` with the actual path to your values file.
```
resource "helm_release" "alloy" {
name = "name-of-your-log-ingester"
repository = "https://grafana.github.io/helm-charts"
chart = "k8s-monitoring"
version = "2.0.2"

namespace = "log-ingester"
create_namespace = true
values = [file("/your-path/to/values.yml")]
}
```
```
resource "helm_release" "alloy" {
name = "name-of-your-log-ingester"
repository = "https://grafana.github.io/helm-charts"
chart = "k8s-monitoring"
version = "2.0.2"

namespace = "log-ingester"
create_namespace = true
values = [file("/your-path/to/values.yml")]
}
```
3. Save your changes.
4. Run `terraform init` to initialize your Terraform configuration and download any necessary providers.
5. Run `terraform apply` to apply your configuration.
Expand Down
69 changes: 34 additions & 35 deletions observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ tags: kubernetes cockpit metrics observability monitoring cluster
categories:
- observability
dates:
validation: 2025/01/20
posted: 2025/01/20
validation: 2025-01-20
posted: 2025-01-20
---


Expand Down Expand Up @@ -45,14 +45,14 @@ destinations:
- name: "my-cockpit-metrics"
type: "prometheus"
protocol: "http"
metrics:
metrics:
enabled: true
url: "$COCKPIT_CUSTOM_METRICS_DATASOURCE_URL/api/v1/push"
tenantId: "$COCKPIT_TOKEN"
logs:

logs:
enabled: false
traces:
traces:
enabled: false

annotationAutodiscovery:
Expand Down Expand Up @@ -112,30 +112,30 @@ resource "kubernetes_deployment_v1" "your_application_deployment" {
## Send Kubernetes metrics using Helm chart with Terraform

1. Create a `provider.tf` file and paste the following template to set up the Helm Terraform provider:
```terraform
provider "helm" {
kubernetes {
host = your_k8s_cluster_host # The URL of your Kubernetes API server.
token = your_k8s_cluster_token # Authentication token to access the cluster.
cluster_ca_certificate = base64decode(
your_k8s_cluster_ca_certificate # The cluster's CA certificate.
)
```terraform
provider "helm" {
kubernetes {
host = your_k8s_cluster_host # The URL of your Kubernetes API server.
token = your_k8s_cluster_token # Authentication token to access the cluster.
cluster_ca_certificate = base64decode(
your_k8s_cluster_ca_certificate # The cluster's CA certificate.
)
}
}
}
```
```
2. Create a `maint.tf` file and paste the following template to create a Helm release resource. Make sure that you replace `/your-path/to/values.yml` with the actual path to your values file.
```
resource "helm_release" "alloy" {
name = "name-of-your-metrics-ingester"
repository = "https://grafana.github.io/helm-charts"
chart = "k8s-monitoring"
version = "2.0.2"

namespace = "metrics-ingester"
create_namespace = true
values = [file("/your-path/to/values.yml")]
}
```
```
resource "helm_release" "alloy" {
name = "name-of-your-metrics-ingester"
repository = "https://grafana.github.io/helm-charts"
chart = "k8s-monitoring"
version = "2.0.2"

namespace = "metrics-ingester"
create_namespace = true
values = [file("/your-path/to/values.yml")]
}
```
3. Save your changes.
4. Run `terraform init` to initialize your Terraform configuration and download any necessary providers.
5. Run `terraform apply` to apply your configuration.
Expand All @@ -147,13 +147,12 @@ Once you have configured your `values.yml` file, you can use Helm to deploy the

1. [Connect](/containers/kubernetes/how-to/connect-cluster-kubectl/) `kubectl` to your Kubernetes cluster
2. Run the command below to install the `k8s-monitoring` Helm chart:
```
helm install -f /your-path/to/values.yml name-of-your-choice-for-your-metric-ingester k8s-monitoring --version 1.6.16
```
The `-f` flag specifies the path to your `values.yml` file, which contains the configuration for the Helm chart. Make sure that you replace `/your-path/to/values.yml` with the correct path where your `values.yml` file is stored. Make sure that you also replace `name-of-your-choice-for-your-metric-ingester` with a clear name (ex. `alloy-metrics-ingester`). In our configuration, we are using `alloy-lm-ingester`.
Helm installs the `k8s-monitoring` chart, which includes the Alloy DaemonSet configured to collect metrics from your Kubernetes cluster.
The DaemonSet ensures that a pod is running on each node in your cluster, which collects metrics and forwards them to the specified Prometheus endpoint in your Cockpit.
```
helm install -f /your-path/to/values.yml name-of-your-choice-for-your-metric-ingester k8s-monitoring --version 1.6.16
```
The `-f` flag specifies the path to your `values.yml` file, which contains the configuration for the Helm chart. Make sure that you replace `/your-path/to/values.yml` with the correct path where your `values.yml` file is stored. Make sure that you also replace `name-of-your-choice-for-your-metric-ingester` with a clear name (ex. `alloy-metrics-ingester`). In our configuration, we are using `alloy-lm-ingester`.
Helm installs the `k8s-monitoring` chart, which includes the Alloy DaemonSet configured to collect metrics from your Kubernetes cluster.
The DaemonSet ensures that a pod is running on each node in your cluster, which collects metrics and forwards them to the specified Prometheus endpoint in your Cockpit.

3. Optionally, check the status of the release to ensure it was installed:

Expand Down

0 comments on commit ec49aa6

Please sign in to comment.