diff --git a/menu/navigation.json b/menu/navigation.json index 6fc4b72960..e10fad4dd1 100644 --- a/menu/navigation.json +++ b/menu/navigation.json @@ -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" diff --git a/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-logs.webp b/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-logs.webp new file mode 100644 index 0000000000..10b2787ca1 Binary files /dev/null and b/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-logs.webp differ diff --git a/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-metrics.webp b/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-metrics.webp new file mode 100644 index 0000000000..cae052223a Binary files /dev/null and b/observability/cockpit/how-to/assets/scaleway-cpt-k8s-terraform-metrics.webp differ diff --git a/observability/cockpit/how-to/send-log-from-k8s-to-cockpit.mdx b/observability/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx similarity index 79% rename from observability/cockpit/how-to/send-log-from-k8s-to-cockpit.mdx rename to observability/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx index 7fac6e1eaa..d97537b7e9 100644 --- a/observability/cockpit/how-to/send-log-from-k8s-to-cockpit.mdx +++ b/observability/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx @@ -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/). @@ -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 @@ -78,7 +78,7 @@ alloy-singleton: 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). ## Send Kubernetes logs using Helm chart @@ -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. diff --git a/observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx b/observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx index c644f4e775..04b0efb78f 100644 --- a/observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx +++ b/observability/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx @@ -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 --- @@ -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: @@ -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. @@ -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: