From 80f05f9e93f0b1fa9b56af04d8483a951bd884af Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 4 May 2023 15:08:19 -0700 Subject: [PATCH 01/31] docs: create metrics getting started guide Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index df78e07f70..b91cd26ce1 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -4,3 +4,178 @@ description: Learn how Keptn metrics enhances your deployment weight: 25 --- +The Keptn metrics component of the Keptn Lifecycle Toolkit +allow you to define any type of metric +from multiple instances of any type of data source in your Kubernetes cluster. +You may have tools like Argo, Flux, KEDA, HBA, Keptn +that need observability data to make automated decisions. +Whether a rollout is good, whether to scale up or down. +Your observability data may come +from multiple observability solutions -- +Datadog, Dynatrace, data in AWS, Google, and Azure -- +and include data in Lifestep (?) and Honeycomb or Splunk. + +The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) +requires that you maintain point-to-point integrations +from Argo Rollouts, Flux, KEDA, and HPA. +Each has plugins but it is difficult to maintain them, +especially if you are using multiple tools +and multible observability platforms. +The Keptn Metrics Server unifies and standardizes access to this data. + +This guide walks you through the steps required +to implement Keptn metrics: + +1. Install the Keptn Lifecycle Toolkit + or just the Keptn Metrics Server in your cluster. +1. Create a CRD to define each observability platform + that is implemented in this namespace. + You can define a mix of platforms -- + Prometheus, Dynatrace, Datadog, etc. -- + and multiple instances of each. +1. Create a CRD that Defines + the type of data to pull from each observability platform. + This data is pulled and fetched continuously + at an interval you specify for each data query. +1. Run the metrics +1. View metrics + +Andi's demo environment: my-klt-demo-with-argo/simplenode-dev + +## Install KLT or just metrics server + +Use the Helm Chart to install the Keptn Metrics Server +as part of the Lifecycle Toolkit +or completely stand-alone. + See +[Install KLT using the Helm Chart](../../install/install.md/#use-helm-chart). + +## Define metrics to use + +### Define metrics providers + +Specify metrics I want to pull in from an external observability platfor + +Two metrics identified +Specify through a CRD the type of data I want to input to my Keptn Metrics Server. +I can pull and fetch that data continuously into Prometheus +Data is available through the CRD and through Prometheus itself +as well as the Kubernetes CLI + +TODO: Need to redo these to use the v1alpha3 synatax + +```yaml +kind: KeptnMetricsProvider +metadata: + name: prometheus + namespace: simplenode-dev +spec: + targetserver: "http://prometheus-k8s-monitoring-svc.cluster.local:9090" +``` + +```yaml +kind: KeptnMetricsProvider +metadata: + name: dynatrace + namespace: simplenode-dev +spec: + targetServer: "https://hci34192.live.dynatrace.com + secretKeyRef + name: dynatrace + key: DT_TOKEN +... +``` + +### Define KeptnMetric information + +Define the information I want to retrieve + +You can define multiple metrics from different metric providers +and multiple instances of each provider + +All in one `keptn-metric.yaml` file + +TODO: Terminology question: is this one file that includes +two CRD's or one CRD that includes multiple metrics? +What if one did multiple queries for a metric provider? + +TODO: Need to redo these to use the v1alpha3 synatax + +Check available CPUs using Prometheus + +Check the availability SLO metric, +retrieved from Dynatrace: + +```yaml +apiVersion: metrics.keptn.sh/v1alpha2 +kind: Keptnmetric +metadata: + name: available-cpus + namespace: simplenode-dev +spec: + provider: + name: prometheus + query: "sum(kube_node_status_cvapacity{resources`cpu`}) + fetchIntervalSeconds" 10 +... +apiVersion: metrics.keptn.sh/v1alpha2 +kind: Keptnmetric +metadata: + name: availability-slo + namespace: simplenode-dev +spec: + provider: + name: dynatrace + query: "func:slo.availability_simplenodeservice" + fetchIntervalSeconds" 10 +... +``` + +One file with two definitions. +Information is fetched in on a continuous basis; +both fetch every 10 seconds. + +Summary: you can define any type of metric +from any data source + +### View available metrics + +```shell +get KeptnMetrics -A +``` + +```shell +NAMESPACE NAME PROVIDER QUERY +simplenode-dev availability-slo dynatrace func:slo.availability_simplenodeservice +simplenode-dev available-cpus prometheus sum(kube_node_status_capacity{resource=`coy}) +``` + +## Run the metrics + +TODO: Do I need to start and stop anything to start gathering metrics +or could I theoretically just put these pieces into my cluster +and would it start gathering metrics that I could then view? + +## Observing the metrics + +TODO: Do we want to say anything about running these metrics, +viewing the results, perhaps from CLI and from Grafana? + +## Implementing autoscaling with HPA + +The Kubernetes HorizontalPodAutoscaler (HPA) +uses metrics to provide autoscaling for the cluster. +HPA can retrieve KeptnMetrics and use it to implement HPA. + +TODO: Link to HPA section in "Implementing" +(which includes link to Flo's blog post) + +## Learn more + +To learn more about the Keptn Metrics Server, see: + +* Architecture: + [Keptn Metrics Operator](../../concepts/architecture/components/metrics-operator/) +* More information about implementing Keptn Metrics: + [Keptn Metrics](../../implementing/metrics.md/) + From 86d4b2faf13dbaf8bc2dfd78fd3cf14abb22c4c6 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 4 May 2023 15:11:40 -0700 Subject: [PATCH 02/31] markdownlint-fix Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index b91cd26ce1..5c1a640f6b 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -178,4 +178,3 @@ To learn more about the Keptn Metrics Server, see: [Keptn Metrics Operator](../../concepts/architecture/components/metrics-operator/) * More information about implementing Keptn Metrics: [Keptn Metrics](../../implementing/metrics.md/) - From 53b10d393e833a678d629994ac03e9256e1916f9 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 4 May 2023 17:51:42 -0700 Subject: [PATCH 03/31] Copy in install Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 5c1a640f6b..56d2f8d361 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -40,7 +40,15 @@ to implement Keptn metrics: 1. Run the metrics 1. View metrics -Andi's demo environment: my-klt-demo-with-argo/simplenode-dev +This exercise is based on the +[simplenode-dev](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd) +example. +You can clone that repo to access it locally +or just look at it for examples +as you implement the functionality "from scratch" +on your local Kubernetes deployment cluster. + +The steps to implement Keptn metrics are: ## Install KLT or just metrics server From 33a290605c12adebc6afaf8334b5adee24487fcf Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Fri, 5 May 2023 23:17:23 -0700 Subject: [PATCH 04/31] fix dead link in metrics-gs Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 56d2f8d361..259f9c1a62 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -185,4 +185,4 @@ To learn more about the Keptn Metrics Server, see: * Architecture: [Keptn Metrics Operator](../../concepts/architecture/components/metrics-operator/) * More information about implementing Keptn Metrics: - [Keptn Metrics](../../implementing/metrics.md/) + [Keptn Metrics](../../implementing/evaluatemetrics.md/) From caccf2df2d3fbf3b9e538f1bcd079517c2e7e763 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Mon, 8 May 2023 01:27:59 -0700 Subject: [PATCH 05/31] updated syntax for KeptnMetricsProvider and KeptnMetric Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 111 ++++++++++++------ 1 file changed, 77 insertions(+), 34 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 259f9c1a62..bbdc631d15 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -26,14 +26,14 @@ The Keptn Metrics Server unifies and standardizes access to this data. This guide walks you through the steps required to implement Keptn metrics: -1. Install the Keptn Lifecycle Toolkit - or just the Keptn Metrics Server in your cluster. -1. Create a CRD to define each observability platform +1. [Install and configure](#install-and-configure-klt) + the Keptn Lifecycle Toolkit in your cluster. +1. Create a resource to define each observability platform that is implemented in this namespace. You can define a mix of platforms -- Prometheus, Dynatrace, Datadog, etc. -- and multiple instances of each. -1. Create a CRD that Defines +1. Create a resource that Defines the type of data to pull from each observability platform. This data is pulled and fetched continuously at an interval you specify for each data query. @@ -48,9 +48,13 @@ or just look at it for examples as you implement the functionality "from scratch" on your local Kubernetes deployment cluster. +See the +[Introducing Keptn Lifecycle Toolkit](https://youtu.be/449HAFYkUlY) +video for a demonstration of this exercise. + The steps to implement Keptn metrics are: -## Install KLT or just metrics server +## Install and configure KLT Use the Helm Chart to install the Keptn Metrics Server as part of the Lifecycle Toolkit @@ -60,33 +64,60 @@ or completely stand-alone. ## Define metrics to use +You need to define the external observability platforms +from which you want to pull data +and then the specific data you want to pull. +This data is pulled and fetched continuously +at an interval you specify for each specific bit of data. +Data is available through the resource and through the data provider itself, +as well as the Kubernetes CLI. + ### Define metrics providers -Specify metrics I want to pull in from an external observability platfor +Populate a +[KeptnMetricsProvider](../../yaml-crd-ref/metricsprovider.md) +resource for each external observability platform you want to use. + +For our example, we define two observability platforms: -Two metrics identified -Specify through a CRD the type of data I want to input to my Keptn Metrics Server. -I can pull and fetch that data continuously into Prometheus -Data is available through the CRD and through Prometheus itself -as well as the Kubernetes CLI +* `dev-prometheus` +* `dev-dynatrace` -TODO: Need to redo these to use the v1alpha3 synatax +You can specify a virtually unlimited number of providers, +including multiple instances of each observability platform. +Each one must be assigned a unique name, +identified by the type of platform it is +and the URL. + +> Note: The video and example application use an older syntax + of the `KeptnMetricsProvider` and `KeptnMetric` resources. + The ones shown in this document are the current ones. + +Definition of +[dev-prometheus](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-prometheus-provider.yaml): ```yaml kind: KeptnMetricsProvider metadata: - name: prometheus + name: dev-prometheus namespace: simplenode-dev spec: + type: prometheus targetserver: "http://prometheus-k8s-monitoring-svc.cluster.local:9090" ``` +Definition of +[dev-dynatrace](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/dynatrace-provider.yaml.tmp). +Note that the `dev-dynatrace` server is protected by a secret key +so that information is included in the provider definition: + ```yaml kind: KeptnMetricsProvider metadata: - name: dynatrace + name: dev-dynatrace namespace: simplenode-dev spec: + type: dynatrace targetServer: "https://hci34192.live.dynatrace.com secretKeyRef name: dynatrace @@ -96,23 +127,24 @@ spec: ### Define KeptnMetric information -Define the information I want to retrieve +The [KeptnMetric](../../yaml-crd-ref/metric.md) resource +defines the information you want to gather, +specified as a query for the particular observability platform +you are using. +You can define any type of metric from any data source. -You can define multiple metrics from different metric providers -and multiple instances of each provider +In our example, we define two bits of information to retrieve: -All in one `keptn-metric.yaml` file +* Number of CPUs, derived from the `dev-prometheus` data platform +* `availability` SLO, derived from the `dev-dynatrace` data platform -TODO: Terminology question: is this one file that includes -two CRD's or one CRD that includes multiple metrics? -What if one did multiple queries for a metric provider? +Each of these are configured to fetch data every 10 seconds +but you could configure a different `fetchIntervalSeconds` value +for each metric. -TODO: Need to redo these to use the v1alpha3 synatax - -Check available CPUs using Prometheus - -Check the availability SLO metric, -retrieved from Dynatrace: +The +[keptn-metric.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-metric.yaml) +file for our example looks like: ```yaml apiVersion: metrics.keptn.sh/v1alpha2 @@ -122,7 +154,7 @@ metadata: namespace: simplenode-dev spec: provider: - name: prometheus + name: dev-prometheus query: "sum(kube_node_status_cvapacity{resources`cpu`}) fetchIntervalSeconds" 10 ... @@ -133,21 +165,32 @@ metadata: namespace: simplenode-dev spec: provider: - name: dynatrace + name: dev-dynatrace query: "func:slo.availability_simplenodeservice" fetchIntervalSeconds" 10 ... ``` -One file with two definitions. -Information is fetched in on a continuous basis; -both fetch every 10 seconds. +Note the following: -Summary: you can define any type of metric -from any data source +* You populate one YAML file +that includes all the metrics for your cluster. +* Each metric is assigned a unique `name`. +* The value of the `spec.provider.name` field + must correspond to the name assigned in a + the `metadata.name` field of a `KeptnMetricsProvider` resource. +* Information is fetched in on a continuous basis +at a rate specified by the value of the `spec.fetchIntervalSeconds` field. ### View available metrics +Use the following command to view +the metrics that are configured in your cluster. +This example displays the two metrics we configured above: + +TODO: Is the syntax of the output changed +to include the `name` of the provider (`dev-prometheus` or `dev-dynatrace`? + ```shell get KeptnMetrics -A ``` From b04853f7c44d30c19c1db80dc3cab1507e0abfea Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Mon, 8 May 2023 05:03:45 -0700 Subject: [PATCH 06/31] Full install/enable/annotations Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 153 ++++++++++++++---- 1 file changed, 123 insertions(+), 30 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index bbdc631d15..ed10458315 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -15,30 +15,7 @@ from multiple observability solutions -- Datadog, Dynatrace, data in AWS, Google, and Azure -- and include data in Lifestep (?) and Honeycomb or Splunk. -The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) -requires that you maintain point-to-point integrations -from Argo Rollouts, Flux, KEDA, and HPA. -Each has plugins but it is difficult to maintain them, -especially if you are using multiple tools -and multible observability platforms. -The Keptn Metrics Server unifies and standardizes access to this data. - -This guide walks you through the steps required -to implement Keptn metrics: - -1. [Install and configure](#install-and-configure-klt) - the Keptn Lifecycle Toolkit in your cluster. -1. Create a resource to define each observability platform - that is implemented in this namespace. - You can define a mix of platforms -- - Prometheus, Dynatrace, Datadog, etc. -- - and multiple instances of each. -1. Create a resource that Defines - the type of data to pull from each observability platform. - This data is pulled and fetched continuously - at an interval you specify for each data query. -1. Run the metrics -1. View metrics +## Using this exercise This exercise is based on the [simplenode-dev](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd) @@ -48,10 +25,122 @@ or just look at it for examples as you implement the functionality "from scratch" on your local Kubernetes deployment cluster. +The steps to implement pre- and post-deployment orchestration are: + +1. [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) +1. [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) +1. [Enable KLT for your cluster](#enable-klt-for-your-cluster) +1. [Integrate KLT with your cluster](#integrate-klt-with-your-cluster) +1. Define metrics to use + * [Define metrics providers](#define-metrics-providers) + * [Define KeptnMetric information](#define-keptnmetric-information) + * [View available metrics](#view-available-metrics) + See the [Introducing Keptn Lifecycle Toolkit](https://youtu.be/449HAFYkUlY) video for a demonstration of this exercise. +## Bring or create a Kubernetes deployment cluster + +You can run this exercise on an existing Kubernetes cluster +or you can create a new cluster. +For personal study and demonstrations, +this exercise runs well on a local Kubernetes cluster. +See [Bring or Install a Kubernetes Cluster](../../install/k8s.md). + +## Install KLT on your cluster + +Install the Keptn Lifecycle Toolkit on your cluster +by executing the following command sequence: + +```shell +helm repo add klt https://charts.lifecycle.keptn.sh +helm repo update +helm upgrade --install keptn klt/klt \ + -n keptn-lifecycle-toolkit-system --create-namespace --wait +``` + +If you only want to use Keptn's metrics features, +you can install just the `metrics-operator` +bu modifying Helm values. +See +[Install KLT](../../install/install.md) +for more information about installing the Lifecycle Toolkit. + +To verify that the `metrics-operator` is installed in your cluster, +run the following command: + +```shell +kubectl get pods -n keptn-lifecycle-toolkit-system +``` + +The output shows all components that are running on your system. + +## Enable KLT for your cluster + +To enable KLT for your cluster, annotate the Kubernetes +[Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) +resource. +In this example, this is defined in the +[simplenode-dev-ns.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/simplenode-dev-ns.yaml) +file, which looks like this: + +```yaml +apiVersion: v1 +kind: Namespace +metadata: + name: simplenode-dev + annotations: + keptn.sh/lifecycle-toolkit: "enabled" +``` + +You see the annotation line that enables `lifecycle-toolkit`. +This line tells the webhook to handle the namespace + +## Integrate KLT with your cluster + +To integrate KLT with your cluster, annotate the Kubernetes +[Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) +resource. +In this example, this is defined in the +[simplenode-dev-deployment.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/simplenode-dev-deployment.yaml) +file, which includes the following lines: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: simplenode + namespace: simplenode-dev +... +template: + metadata: + labels: + app: simplenode + app.kubernetes.io/name: simplenodeservice + annotations: + # keptn.sh/app: simpleapp + keptn.sh/workload: simplenode + keptn.sh/version: 1.0.2 + keptn.sh/pre-deployment-evaluations: evaluate-dependencies + keptn.sh/pre-deployment-tasks: notify + keptn.sh/post-deployment-evaluations: evaluate-deployment + keptn.sh/post-deployment-tasks: notify +... +``` + +For more information about using annotations and labels +to integrate KLT into your deployment cluster, see +[Integrate KLT with your applications](../../implementing/integrate.md). + +The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) +requires that you maintain point-to-point integrations +from Argo Rollouts, Flux, KEDA, and HPA. +Each has plugins but it is difficult to maintain them, +especially if you are using multiple tools +and multible observability platforms. +The Keptn Metrics Server unifies and standardizes access to this data. + The steps to implement Keptn metrics are: ## Install and configure KLT @@ -61,6 +150,7 @@ as part of the Lifecycle Toolkit or completely stand-alone. See [Install KLT using the Helm Chart](../../install/install.md/#use-helm-chart). +-- End of Probably goes -- ## Define metrics to use @@ -91,10 +181,11 @@ and the URL. > Note: The video and example application use an older syntax of the `KeptnMetricsProvider` and `KeptnMetric` resources. - The ones shown in this document are the current ones. + The syntax shown in this document is correct for v0.7.1 and later. Definition of -[dev-prometheus](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-prometheus-provider.yaml): +[dev-prometheus](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-prometheus-provider.yaml) +data source: ```yaml kind: KeptnMetricsProvider @@ -106,8 +197,9 @@ spec: targetserver: "http://prometheus-k8s-monitoring-svc.cluster.local:9090" ``` -Definition of -[dev-dynatrace](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/dynatrace-provider.yaml.tmp). +Definition of the +[dev-dynatrace](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/dynatrace-provider.yaml.tmp) +data source. Note that the `dev-dynatrace` server is protected by a secret key so that information is included in the provider definition: @@ -217,9 +309,10 @@ viewing the results, perhaps from CLI and from Grafana? The Kubernetes HorizontalPodAutoscaler (HPA) uses metrics to provide autoscaling for the cluster. HPA can retrieve KeptnMetrics and use it to implement HPA. +See Using the HorizontalPodAutoscaler](../../implmenting/evaluatemetrics) +for detailed information. -TODO: Link to HPA section in "Implementing" -(which includes link to Flo's blog post) +TODO: Link to HPA subsection after that content is merged ## Learn more From 651adc6dacf4771219139249e5a7cc29920e7781 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Mon, 8 May 2023 23:59:34 -0700 Subject: [PATCH 07/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index ed10458315..3d018fd046 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -247,7 +247,7 @@ metadata: spec: provider: name: dev-prometheus - query: "sum(kube_node_status_cvapacity{resources`cpu`}) + query: "sum(kube_node_status_cvapacity{resources`cpu`})" fetchIntervalSeconds" 10 ... apiVersion: metrics.keptn.sh/v1alpha2 From 0ade565bbcfce1439179b59922e9bca49b0fc03b Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:00:11 -0700 Subject: [PATCH 08/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 3d018fd046..07f6f0f2f3 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -7,7 +7,7 @@ weight: 25 The Keptn metrics component of the Keptn Lifecycle Toolkit allow you to define any type of metric from multiple instances of any type of data source in your Kubernetes cluster. -You may have tools like Argo, Flux, KEDA, HBA, Keptn +You may have tools like Argo, Flux, KEDA, HPA, or Keptn that need observability data to make automated decisions. Whether a rollout is good, whether to scale up or down. Your observability data may come From 4b006b45e6abe90904e123938c06a8a0ac268375 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:00:55 -0700 Subject: [PATCH 09/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 07f6f0f2f3..87035ecf93 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -12,8 +12,7 @@ that need observability data to make automated decisions. Whether a rollout is good, whether to scale up or down. Your observability data may come from multiple observability solutions -- -Datadog, Dynatrace, data in AWS, Google, and Azure -- -and include data in Lifestep (?) and Honeycomb or Splunk. +Datadog, Dynatrace, Lightstep, Honeycomb, Splunk, or data directly from your cloud provider such as AWS, Google, and Azure. ## Using this exercise From 3b834090eeb279cdc324b623dd097219fdd7d5d6 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:01:16 -0700 Subject: [PATCH 10/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 87035ecf93..478415f48f 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -30,7 +30,7 @@ The steps to implement pre- and post-deployment orchestration are: 1. [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) 1. [Enable KLT for your cluster](#enable-klt-for-your-cluster) 1. [Integrate KLT with your cluster](#integrate-klt-with-your-cluster) -1. Define metrics to use +1. Configure metrics to use * [Define metrics providers](#define-metrics-providers) * [Define KeptnMetric information](#define-keptnmetric-information) * [View available metrics](#view-available-metrics) From 7c1fd1937bf5e43b5d8fcde329f21777af280850 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:04:47 -0700 Subject: [PATCH 11/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 478415f48f..f944a9beba 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -94,7 +94,7 @@ metadata: ``` You see the annotation line that enables `lifecycle-toolkit`. -This line tells the webhook to handle the namespace +This line tells KLT to handle the namespace ## Integrate KLT with your cluster From c257b08a0bd7fc63812ab7faac8e027a0d738edd Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:05:05 -0700 Subject: [PATCH 12/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index f944a9beba..bad72d8b69 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -98,7 +98,7 @@ This line tells KLT to handle the namespace ## Integrate KLT with your cluster -To integrate KLT with your cluster, annotate the Kubernetes +To integrate KLT with your deployment, annotate the Kubernetes [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) resource. In this example, this is defined in the From 6cf7572f0efce45963e19622fb2e1c5632bab38e Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:05:33 -0700 Subject: [PATCH 13/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index bad72d8b69..d7d780e396 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -209,7 +209,7 @@ metadata: namespace: simplenode-dev spec: type: dynatrace - targetServer: "https://hci34192.live.dynatrace.com + targetServer: "https://hci34192.live.dynatrace.com" secretKeyRef name: dynatrace key: DT_TOKEN From ba579d2491537a326182e5ba05ed2f3cfd8159c5 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:22:46 -0700 Subject: [PATCH 14/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index d7d780e396..e11bbe46f6 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -247,7 +247,7 @@ spec: provider: name: dev-prometheus query: "sum(kube_node_status_cvapacity{resources`cpu`})" - fetchIntervalSeconds" 10 + fetchIntervalSeconds: 10 ... apiVersion: metrics.keptn.sh/v1alpha2 kind: Keptnmetric From eae05ba4a429c215350b70a4fdf7b413718ed593 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 00:23:14 -0700 Subject: [PATCH 15/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index e11bbe46f6..f319362069 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -258,7 +258,7 @@ spec: provider: name: dev-dynatrace query: "func:slo.availability_simplenodeservice" - fetchIntervalSeconds" 10 + fetchIntervalSeconds: 10 ... ``` From b7842bce7ea16ffc42fd3c6251afdde3f8fb2d07 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 02:18:39 -0700 Subject: [PATCH 16/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index f319362069..64c18857a0 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -96,7 +96,7 @@ metadata: You see the annotation line that enables `lifecycle-toolkit`. This line tells KLT to handle the namespace -## Integrate KLT with your cluster +## Integrate KLT with your deployment To integrate KLT with your deployment, annotate the Kubernetes [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) From 5e10ab030065bd3fbb7f5fa56a97974e0de969c8 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Tue, 9 May 2023 02:40:50 -0700 Subject: [PATCH 17/31] Giovanni comments Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index ed10458315..46b82b3946 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -30,7 +30,7 @@ The steps to implement pre- and post-deployment orchestration are: 1. [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) 1. [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) 1. [Enable KLT for your cluster](#enable-klt-for-your-cluster) -1. [Integrate KLT with your cluster](#integrate-klt-with-your-cluster) +1. [Integrate KLT with your cluster](##integrate-klt-with-your-cluster) 1. Define metrics to use * [Define metrics providers](#define-metrics-providers) * [Define KeptnMetric information](#define-keptnmetric-information) @@ -46,7 +46,8 @@ You can run this exercise on an existing Kubernetes cluster or you can create a new cluster. For personal study and demonstrations, this exercise runs well on a local Kubernetes cluster. -See [Bring or Install a Kubernetes Cluster](../../install/k8s.md). +See [Bring or Install a Kubernetes Cluster](../../install/k8s.md) +in the *Installation* section. ## Install KLT on your cluster @@ -62,7 +63,7 @@ helm upgrade --install keptn klt/klt \ If you only want to use Keptn's metrics features, you can install just the `metrics-operator` -bu modifying Helm values. +by modifying Helm values. See [Install KLT](../../install/install.md) for more information about installing the Lifecycle Toolkit. @@ -141,17 +142,6 @@ especially if you are using multiple tools and multible observability platforms. The Keptn Metrics Server unifies and standardizes access to this data. -The steps to implement Keptn metrics are: - -## Install and configure KLT - -Use the Helm Chart to install the Keptn Metrics Server -as part of the Lifecycle Toolkit -or completely stand-alone. - See -[Install KLT using the Helm Chart](../../install/install.md/#use-helm-chart). --- End of Probably goes -- - ## Define metrics to use You need to define the external observability platforms @@ -265,8 +255,8 @@ spec: Note the following: -* You populate one YAML file -that includes all the metrics for your cluster. +* Populate one YAML file per metric + then apply all of them. * Each metric is assigned a unique `name`. * The value of the `spec.provider.name` field must correspond to the name assigned in a From 8da28518d4c77354f45e8c0b162150995b9c51f4 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 11 May 2023 07:33:36 +0200 Subject: [PATCH 18/31] fix markdownlint issues Signed-off-by: Simon Schrottner --- docs/content/en/docs/getting-started/metrics/_index.md | 4 ++-- .../en/docs/implementing/integrate/{index.md => _index.md} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/content/en/docs/implementing/integrate/{index.md => _index.md} (100%) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index c1d7fce286..e57efaa76b 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -29,7 +29,7 @@ The steps to implement pre- and post-deployment orchestration are: 1. [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) 1. [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) 1. [Enable KLT for your cluster](#enable-klt-for-your-cluster) -1. [Integrate KLT with your cluster](#integrate-klt-with-your-cluster) +1. [Integrate KLT with your cluster](#integrate-klt-with-your-deployment) 1. Configure metrics to use * [Define metrics providers](#define-metrics-providers) * [Define KeptnMetric information](#define-keptnmetric-information) @@ -131,7 +131,7 @@ template: For more information about using annotations and labels to integrate KLT into your deployment cluster, see -[Integrate KLT with your applications](../../implementing/integrate.md). +[Integrate KLT with your applications](../../implementing/integrate/_index.md). The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) requires that you maintain point-to-point integrations diff --git a/docs/content/en/docs/implementing/integrate/index.md b/docs/content/en/docs/implementing/integrate/_index.md similarity index 100% rename from docs/content/en/docs/implementing/integrate/index.md rename to docs/content/en/docs/implementing/integrate/_index.md From 372277f12d058c44878d1fd96ec5592fd3746626 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 00:44:26 -0700 Subject: [PATCH 19/31] a bit of polishing Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index e57efaa76b..8797061bfd 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -12,7 +12,18 @@ that need observability data to make automated decisions. Whether a rollout is good, whether to scale up or down. Your observability data may come from multiple observability solutions -- -Datadog, Dynatrace, Lightstep, Honeycomb, Splunk, or data directly from your cloud provider such as AWS, Google, and Azure. +Datadog, Dynatrace, Lightstep, Honeycomb, Splunk, +or data directly from your cloud provider such as AWS, Google, or Azure. + +The +[Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) +requires that you maintain point-to-point integrations +from Argo Rollouts, Flux, KEDA, and HPA. +Each has plugins but it is difficult to maintain them, +especially if you are using multiple tools, +and multible observability platforms, +and multiple instance of some tools or observability platforms. +The Keptn Metrics Server unifies and standardizes access to this data. ## Using this exercise @@ -24,12 +35,13 @@ or just look at it for examples as you implement the functionality "from scratch" on your local Kubernetes deployment cluster. -The steps to implement pre- and post-deployment orchestration are: +The steps to implement metrics are: -1. [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) -1. [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) -1. [Enable KLT for your cluster](#enable-klt-for-your-cluster) -1. [Integrate KLT with your cluster](#integrate-klt-with-your-deployment) +1. Install and configure Keptn Lifecycle Toolkit + - [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) + - [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) + - [Enable KLT for your cluster](#enable-klt-for-your-cluster) + - [Integrate KLT with your cluster](#integrate-klt-with-your-deployment) 1. Configure metrics to use * [Define metrics providers](#define-metrics-providers) * [Define KeptnMetric information](#define-keptnmetric-information) @@ -46,7 +58,7 @@ or you can create a new cluster. For personal study and demonstrations, this exercise runs well on a local Kubernetes cluster. See [Bring or Install a Kubernetes Cluster](../../install/k8s.md) -in the *Installation* section. +in the *Installation* section for more information. ## Install KLT on your cluster @@ -60,13 +72,14 @@ helm upgrade --install keptn klt/klt \ -n keptn-lifecycle-toolkit-system --create-namespace --wait ``` -If you only want to use Keptn's metrics features, +> Note: If you only want to use the Keptn metrics features, you can install just the `metrics-operator` by modifying Helm values. See [Install KLT](../../install/install.md) for more information about installing the Lifecycle Toolkit. + To verify that the `metrics-operator` is installed in your cluster, run the following command: @@ -133,14 +146,6 @@ For more information about using annotations and labels to integrate KLT into your deployment cluster, see [Integrate KLT with your applications](../../implementing/integrate/_index.md). -The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) -requires that you maintain point-to-point integrations -from Argo Rollouts, Flux, KEDA, and HPA. -Each has plugins but it is difficult to maintain them, -especially if you are using multiple tools -and multible observability platforms. -The Keptn Metrics Server unifies and standardizes access to this data. - ## Define metrics to use You need to define the external observability platforms From 7189c15ea937650afa2242f3f1f1e7ba376a4590 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 01:50:30 -0700 Subject: [PATCH 20/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 8797061bfd..aff49779a0 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -278,7 +278,7 @@ TODO: Is the syntax of the output changed to include the `name` of the provider (`dev-prometheus` or `dev-dynatrace`? ```shell -get KeptnMetrics -A +kubectl get KeptnMetrics -A ``` ```shell From 063ec52d3f39c6dc433dccc09e0579c400f863c0 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 01:59:38 -0700 Subject: [PATCH 21/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index aff49779a0..d1015c5b1a 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -283,8 +283,8 @@ kubectl get KeptnMetrics -A ```shell NAMESPACE NAME PROVIDER QUERY -simplenode-dev availability-slo dynatrace func:slo.availability_simplenodeservice -simplenode-dev available-cpus prometheus sum(kube_node_status_capacity{resource=`coy}) +simplenode-dev availability-slo dev-dynatrace func:slo.availability_simplenodeservice +simplenode-dev available-cpus dev-prometheus sum(kube_node_status_capacity{resource=`cpu`}) ``` ## Run the metrics From 805cf1fa48783bac5636884fd15f6ddc3c6edf6c Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 02:01:50 -0700 Subject: [PATCH 22/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index d1015c5b1a..d652878d07 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -303,7 +303,7 @@ viewing the results, perhaps from CLI and from Grafana? The Kubernetes HorizontalPodAutoscaler (HPA) uses metrics to provide autoscaling for the cluster. HPA can retrieve KeptnMetrics and use it to implement HPA. -See Using the HorizontalPodAutoscaler](../../implmenting/evaluatemetrics) +See Using the [HorizontalPodAutoscaler](../../implmenting/evaluatemetrics) for detailed information. TODO: Link to HPA subsection after that content is merged From 489b08386c76af74c43a2d5b0d7abe5982bf68db Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 04:34:37 -0700 Subject: [PATCH 23/31] Giovanni's comments Signed-off-by: Meg McRoberts --- .../en/docs/getting-started/metrics/_index.md | 190 +++++++----------- 1 file changed, 74 insertions(+), 116 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index d652878d07..2e51365c93 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -15,6 +15,9 @@ from multiple observability solutions -- Datadog, Dynatrace, Lightstep, Honeycomb, Splunk, or data directly from your cloud provider such as AWS, Google, or Azure. +The Keptn Lifecycle Toolkit hooks directly into Kubernetes primitives +so minimal configuration is required. + The [Kubernetes metric server](https://github.com/kubernetes-sigs/metrics-server) requires that you maintain point-to-point integrations @@ -35,117 +38,21 @@ or just look at it for examples as you implement the functionality "from scratch" on your local Kubernetes deployment cluster. -The steps to implement metrics are: +The steps to implement metrics in an existing cluster are: -1. Install and configure Keptn Lifecycle Toolkit - - [Bring or create a Kubernetes cluster](#bring-or-create-a-kubernetes-deployment-cluster) - - [Install the Keptn Lifecycle Toolkit on your cluster](#install-klt-on-your-cluster) - - [Enable KLT for your cluster](#enable-klt-for-your-cluster) - - [Integrate KLT with your cluster](#integrate-klt-with-your-deployment) +1. [Install the Keptn Lifecycle Toolkit](../../install/install) 1. Configure metrics to use - * [Define metrics providers](#define-metrics-providers) - * [Define KeptnMetric information](#define-keptnmetric-information) - * [View available metrics](#view-available-metrics) + - [Define metrics providers](#define-metrics-providers) + - [Define KeptnMetric information](#define-keptnmetric-information) + - [View available metrics](#view-available-metrics) + +If you want to create your own cluster to run this exercise, +follow the instructions in [Installation](../../install). See the [Introducing Keptn Lifecycle Toolkit](https://youtu.be/449HAFYkUlY) video for a demonstration of this exercise. -## Bring or create a Kubernetes deployment cluster - -You can run this exercise on an existing Kubernetes cluster -or you can create a new cluster. -For personal study and demonstrations, -this exercise runs well on a local Kubernetes cluster. -See [Bring or Install a Kubernetes Cluster](../../install/k8s.md) -in the *Installation* section for more information. - -## Install KLT on your cluster - -Install the Keptn Lifecycle Toolkit on your cluster -by executing the following command sequence: - -```shell -helm repo add klt https://charts.lifecycle.keptn.sh -helm repo update -helm upgrade --install keptn klt/klt \ - -n keptn-lifecycle-toolkit-system --create-namespace --wait -``` - -> Note: If you only want to use the Keptn metrics features, -you can install just the `metrics-operator` -by modifying Helm values. -See -[Install KLT](../../install/install.md) -for more information about installing the Lifecycle Toolkit. - - -To verify that the `metrics-operator` is installed in your cluster, -run the following command: - -```shell -kubectl get pods -n keptn-lifecycle-toolkit-system -``` - -The output shows all components that are running on your system. - -## Enable KLT for your cluster - -To enable KLT for your cluster, annotate the Kubernetes -[Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) -resource. -In this example, this is defined in the -[simplenode-dev-ns.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/simplenode-dev-ns.yaml) -file, which looks like this: - -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: simplenode-dev - annotations: - keptn.sh/lifecycle-toolkit: "enabled" -``` - -You see the annotation line that enables `lifecycle-toolkit`. -This line tells KLT to handle the namespace - -## Integrate KLT with your deployment - -To integrate KLT with your deployment, annotate the Kubernetes -[Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) -resource. -In this example, this is defined in the -[simplenode-dev-deployment.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/simplenode-dev-deployment.yaml) -file, which includes the following lines: - -```yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: simplenode - namespace: simplenode-dev -... -template: - metadata: - labels: - app: simplenode - app.kubernetes.io/name: simplenodeservice - annotations: - # keptn.sh/app: simpleapp - keptn.sh/workload: simplenode - keptn.sh/version: 1.0.2 - keptn.sh/pre-deployment-evaluations: evaluate-dependencies - keptn.sh/pre-deployment-tasks: notify - keptn.sh/post-deployment-evaluations: evaluate-deployment - keptn.sh/post-deployment-tasks: notify -... -``` - -For more information about using annotations and labels -to integrate KLT into your deployment cluster, see -[Integrate KLT with your applications](../../implementing/integrate/_index.md). - ## Define metrics to use You need to define the external observability platforms @@ -164,8 +71,8 @@ resource for each external observability platform you want to use. For our example, we define two observability platforms: -* `dev-prometheus` -* `dev-dynatrace` +- `dev-prometheus` +- `dev-dynatrace` You can specify a virtually unlimited number of providers, including multiple instances of each observability platform. @@ -259,13 +166,13 @@ spec: Note the following: -* Populate one YAML file per metric +- Populate one YAML file per metric then apply all of them. -* Each metric is assigned a unique `name`. -* The value of the `spec.provider.name` field +- Each metric is assigned a unique `name`. +- The value of the `spec.provider.name` field must correspond to the name assigned in a the `metadata.name` field of a `KeptnMetricsProvider` resource. -* Information is fetched in on a continuous basis +- Information is fetched in on a continuous basis at a rate specified by the value of the `spec.fetchIntervalSeconds` field. ### View available metrics @@ -282,21 +189,72 @@ kubectl get KeptnMetrics -A ``` ```shell -NAMESPACE NAME PROVIDER QUERY +NAMESPACE NAME PROVIDER QUERY simplenode-dev availability-slo dev-dynatrace func:slo.availability_simplenodeservice simplenode-dev available-cpus dev-prometheus sum(kube_node_status_capacity{resource=`cpu`}) ``` ## Run the metrics -TODO: Do I need to start and stop anything to start gathering metrics -or could I theoretically just put these pieces into my cluster -and would it start gathering metrics that I could then view? +As soon as you define your `KeptnMetricsProvider` and `KeptnMetric` resources, +the Lifecycle Toolkit begins collecting the metrics you defined. +You do not need to do anything else. ## Observing the metrics -TODO: Do we want to say anything about running these metrics, -viewing the results, perhaps from CLI and from Grafana? +The metrics can be retrieved +through CRs and through the Kubernetes Metric API. + +The syntax to retrieve metrics from the CR is: + +```shell +kubectl get keptnmetrics.metrics.keptn.sh -n +``` + +For example, the output for the `available-cpus` metric looks like: + +```shell +$ kubectl get keptnmetrics.metrics.keptn.sh -n simplenode-dev available-cpus + +NAME PROVIDER QUERY VALUE +cpu-throttling my-provider sum(kube_node_status_capacity{resource=`coy}) 6.000 +``` + +The syntax to retrieve metrics through the Kubernetes API is: + +```yaml +kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces//keptnmetrics.metrics.sh//" +``` + +For example, the output for the `available-cpus` looks like: + +```yaml +$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/simplenode-dev/keptnmetrics.metrics.sh/available-cpus/available-cpus" + +{ + "kind": "MetricValueList", + "apiVersion": "custom.metrics.k8s.io/v1beta2", + "metadata": {}, + "items": [ + { + "describedObject": { + "kind": "KeptnMetric", + "namespace": "simplenode-dev", + "name": "available-cpus", + "apiVersion": "metrics.keptn.sh/v1alpha2" + }, + "metric": { + "name": "available-cpus", + "selector": {} + }, + "timestamp": "2023-05-11T08:05:36Z", + "value": "6" + } + ] +} +``` + +You can also display the graphics using a dashboard such as Grafana. ## Implementing autoscaling with HPA From 2408885cedf90a84bef26b5ef8ffd157b7cf9d18 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 05:14:23 -0700 Subject: [PATCH 24/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 2e51365c93..1a823d8ba4 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -181,8 +181,6 @@ Use the following command to view the metrics that are configured in your cluster. This example displays the two metrics we configured above: -TODO: Is the syntax of the output changed -to include the `name` of the provider (`dev-prometheus` or `dev-dynatrace`? ```shell kubectl get KeptnMetrics -A From 6fc59826489559f6207431c3f7b9505ec5f1b2c3 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 05:30:27 -0700 Subject: [PATCH 25/31] markdownlint-fix Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 1a823d8ba4..29861a148e 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -128,8 +128,8 @@ You can define any type of metric from any data source. In our example, we define two bits of information to retrieve: -* Number of CPUs, derived from the `dev-prometheus` data platform -* `availability` SLO, derived from the `dev-dynatrace` data platform +- Number of CPUs, derived from the `dev-prometheus` data platform +- `availability` SLO, derived from the `dev-dynatrace` data platform Each of these are configured to fetch data every 10 seconds but you could configure a different `fetchIntervalSeconds` value @@ -181,7 +181,6 @@ Use the following command to view the metrics that are configured in your cluster. This example displays the two metrics we configured above: - ```shell kubectl get KeptnMetrics -A ``` @@ -268,7 +267,7 @@ TODO: Link to HPA subsection after that content is merged To learn more about the Keptn Metrics Server, see: -* Architecture: +- Architecture: [Keptn Metrics Operator](../../concepts/architecture/components/metrics-operator/) -* More information about implementing Keptn Metrics: +- More information about implementing Keptn Metrics: [Keptn Metrics](../../implementing/evaluatemetrics.md/) From c9093ffd6b503097116a5c273bb7ff9e3583e329 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:10:29 -0700 Subject: [PATCH 26/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 29861a148e..104ad96668 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -214,7 +214,7 @@ For example, the output for the `available-cpus` metric looks like: $ kubectl get keptnmetrics.metrics.keptn.sh -n simplenode-dev available-cpus NAME PROVIDER QUERY VALUE -cpu-throttling my-provider sum(kube_node_status_capacity{resource=`coy}) 6.000 +cpu-throttling my-provider sum(kube_node_status_capacity{resource=`cpu`}) 6.000 ``` The syntax to retrieve metrics through the Kubernetes API is: From 7343221811b2ad1a947b31e4b54a7d79e5337342 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:20:02 -0700 Subject: [PATCH 27/31] HPA xref Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 104ad96668..b9d7f25f62 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -261,7 +261,9 @@ HPA can retrieve KeptnMetrics and use it to implement HPA. See Using the [HorizontalPodAutoscaler](../../implmenting/evaluatemetrics) for detailed information. -TODO: Link to HPA subsection after that content is merged +See +[Using the HorizontalPodAutoscaler](../../implementing/evaluatemetrics/#using-the-horizontalpodautoscaler) +for more information. ## Learn more From 7ab5779297f8a80620a7e79d6b90f475844064cf Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:27:08 -0700 Subject: [PATCH 28/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Giovanni Liva Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index b9d7f25f62..79c865575c 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -40,7 +40,7 @@ on your local Kubernetes deployment cluster. The steps to implement metrics in an existing cluster are: -1. [Install the Keptn Lifecycle Toolkit](../../install/install) +1. [Install the Keptn Lifecycle Toolkit](../../install/install/) 1. Configure metrics to use - [Define metrics providers](#define-metrics-providers) - [Define KeptnMetric information](#define-keptnmetric-information) From e49dfb9869343eef95d231626c21400979643740 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:39:15 -0700 Subject: [PATCH 29/31] fix xref structure Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index b9d7f25f62..d4acc0bed2 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -40,7 +40,7 @@ on your local Kubernetes deployment cluster. The steps to implement metrics in an existing cluster are: -1. [Install the Keptn Lifecycle Toolkit](../../install/install) +1. [Install the Keptn Lifecycle Toolkit](../../install/install.md) 1. Configure metrics to use - [Define metrics providers](#define-metrics-providers) - [Define KeptnMetric information](#define-keptnmetric-information) @@ -258,13 +258,9 @@ You can also display the graphics using a dashboard such as Grafana. The Kubernetes HorizontalPodAutoscaler (HPA) uses metrics to provide autoscaling for the cluster. HPA can retrieve KeptnMetrics and use it to implement HPA. -See Using the [HorizontalPodAutoscaler](../../implmenting/evaluatemetrics) +See Using the [HorizontalPodAutoscaler](../../implmenting/evaluatemetrics.md) for detailed information. -See -[Using the HorizontalPodAutoscaler](../../implementing/evaluatemetrics/#using-the-horizontalpodautoscaler) -for more information. - ## Learn more To learn more about the Keptn Metrics Server, see: From 9d11971f21c73703b76669ea2d193849714c0304 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:41:16 -0700 Subject: [PATCH 30/31] Update docs/content/en/docs/getting-started/metrics/_index.md Signed-off-by: Meg McRoberts meg.mcroberts@dynatrace.com Co-authored-by: Florian Bacher Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 79c865575c..111f5dcfff 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -150,7 +150,7 @@ spec: name: dev-prometheus query: "sum(kube_node_status_cvapacity{resources`cpu`})" fetchIntervalSeconds: 10 -... +--- apiVersion: metrics.keptn.sh/v1alpha2 kind: Keptnmetric metadata: @@ -161,7 +161,6 @@ spec: name: dev-dynatrace query: "func:slo.availability_simplenodeservice" fetchIntervalSeconds: 10 -... ``` Note the following: From ac3728f1a0c983cdf23863c2b1908c7a7ca08384 Mon Sep 17 00:00:00 2001 From: Meg McRoberts Date: Thu, 11 May 2023 07:53:11 -0700 Subject: [PATCH 31/31] more xref Signed-off-by: Meg McRoberts --- docs/content/en/docs/getting-started/metrics/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/en/docs/getting-started/metrics/_index.md b/docs/content/en/docs/getting-started/metrics/_index.md index 0f5c78377d..777240bca4 100644 --- a/docs/content/en/docs/getting-started/metrics/_index.md +++ b/docs/content/en/docs/getting-started/metrics/_index.md @@ -257,7 +257,8 @@ You can also display the graphics using a dashboard such as Grafana. The Kubernetes HorizontalPodAutoscaler (HPA) uses metrics to provide autoscaling for the cluster. HPA can retrieve KeptnMetrics and use it to implement HPA. -See Using the [HorizontalPodAutoscaler](../../implmenting/evaluatemetrics.md) +See +Using the [HorizontalPodAutoscaler](../../implementing/evaluatemetrics/#using-the-horizontalpodautoscaler) for detailed information. ## Learn more