Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: analysis for non-k8s deployments #2778

Merged
merged 10 commits into from
Jan 12, 2024
14 changes: 7 additions & 7 deletions docs-new/docs/migrate/strategy.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Migration strategy

> **Note**
This section is under development.
Information that is published here has been reviewed for technical accuracy
but the format and content is still evolving.
We hope you will contribute your experiences
and questions that you have.

Before you begin the migration project,
we suggest that you run through the exercises in
[Getting started](../getting-started/index.md)
Expand All @@ -30,6 +23,13 @@ Much of the logic and functionality of your Keptn v1 projects
can be migrated to Keptn
but must be rewritten to utilize Keptn components.

Keptn targets deployments that run on Kubernetes
but some Keptn functionality can be used with deployments
that do not run on Kubernetes.
See
[Keptn for non-Kubernetes deployments](../use-cases/non-k8s.md)
for details.

Some key points:

* Keptn uses native Kubernetes CRDs
Expand Down
114 changes: 92 additions & 22 deletions docs-new/docs/use-cases/non-k8s.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
# Keptn - Kubernetes
# Keptn for non-Kubernetes deployments

Keptn Tasks running on a Kubernetes cluster
can be triggered for [workloads](https://kubernetes.io/docs/concepts/workloads/) and applications
that are deployed outside of Kubernetes.
For example, Keptn could trigger load and performance tests
for an application that is deployed on a virtual machine.

To do this:
Keptn can interact with deployments that are not running on Kubernetes
even though Keptn mainly targets Kubernetes deployments.
The following functionality is available for deployments not on Kubernetes:

- [Install Keptn on a Kubernetes cluster](#install-keptn-on-a-kubernetes-cluster)
- [Create a KeptnTaskDefinition](#create-a-keptntaskdefinition)
- [Create and apply a KeptnTask](#create-and-apply-a-keptntask)
- [Re-run the KeptnTask](#re-run-the-keptntask)
- [Run Keptn tasks](#run-keptntask-for-a-deployment-not-on-kubernetes)
- [Run Keptn analysis](#run-keptn-analysis-for-a-deployment-not-on-kubernetes)

## Install Keptn on a Kubernetes cluster

You must set up a Kubernetes cluster and
To use either of these features,
you must set up a Kubernetes cluster and
[install](../installation/index.md#basic-installation)
Keptn on it,
but this can be a very lightweight, single-node KinD cluster; see
[Create local Kubernetes cluster](../installation/k8s.md#create-local-kubernetes-cluster).
Keptn only triggers on-demand `KeptnTask` resources
Keptn only runs on-demand `KeptnTask` and `KeptnAnalysis` resources
so resource utilization is minimal.

## Create a KeptnTaskDefinition
## Run KeptnTask for a deployment not on Kubernetes

Keptn tasks running on a Kubernetes cluster can be triggered for
[workloads](https://kubernetes.io/docs/concepts/workloads/)
and applications that are deployed outside of Kubernetes.
For example, Keptn can run (or "trigger")
load and performance tests
for an application that is deployed on a virtual machine.
It does this by specifying a container image that should be executed.
StackScribe marked this conversation as resolved.
Show resolved Hide resolved
You specify the container in a `KeptnTaskDefinition` resource; see
[Deployment tasks](../guides/tasks.md) for more information.
The `KeptnTask` runs as a Kubernetes
[job](https://kubernetes.io/docs/concepts/workloads/controllers/job/)
on the cluster where Keptn is installed.

To implement this, install Keptn on a Kubernetes cluster
as described above, then::

- [Create a KeptnTaskDefinition](#create-a-keptntaskdefinition)
- [Create and apply a KeptnTask](#create-and-apply-a-keptntask)
- [Re-run the KeptnTask](#re-run-the-keptntask)

### Create a KeptnTaskDefinition

When you have Keptn installed, create a
YAML file that defines what you want to execute
Expand Down Expand Up @@ -58,11 +73,14 @@ See
[Runners and containers](../guides/tasks.md#runners-and-containers)
for more information.

## Create and apply a KeptnTask
### Create and apply a KeptnTask

You must manually create the
[KeptnTask](../reference/crd-reference/task.md) resource.
In the standard operating mode, when Keptn is managing [workloads](https://kubernetes.io/docs/concepts/workloads/),
In the standard operating mode,
when Keptn is managing
[workloads](https://kubernetes.io/docs/concepts/workloads/)
for deployments running on Kubernetes,
the creation of the `KeptnTask` resource is automatic.

Moreover, each time you want to execute a `KeptnTask`,
Expand Down Expand Up @@ -96,7 +114,10 @@ You can then apply this YAML file with the following command:
kubectl apply -f test-task.yaml -n my-keptn-annotated-namespace
```

Applying this file causes Keptn to create a Job and a Pod
Applying this file causes Keptn to create a Kubernetes
[job](https://kubernetes.io/docs/concepts/workloads/controllers/job/)
and a Kubernetes
StackScribe marked this conversation as resolved.
Show resolved Hide resolved
[pod](https://kubernetes.io/docs/concepts/workloads/pods/)
and run the executables defined
in the associated `KeptnTaskDefinition` resource.

Expand All @@ -107,7 +128,9 @@ kubectl get keptntasks -n my-keptn-annotated-namespace
kubectl get pods -n my-keptn-annotated-namespace
```

## Re-run the KeptnTask
See the

StackScribe marked this conversation as resolved.
Show resolved Hide resolved
### Re-run the KeptnTask

For subsequent KeptnTask runs,
the `KeptnTask` name and version fields must be unique,
Expand All @@ -134,8 +157,55 @@ spec:
workloadVersion: "1.0.1"
```

You can then apply this file with the following command:
Use the following command to apply this resource:

```shell
kubectl apply -f test-task-2.yaml -n my-keptn-annotated-namespace
```

See the
[Deployment tasks](../guides/tasks.md)
guide and associated reference pages
for more information about running Keptn tasks
with deployments that do not run on Kubernetes.

## Run Keptn analysis for a deployment not on Kubernetes

The Keptn analyses feature
analyzes Service Level Objectives (SLOs)
based on Service Level Inputs (SLIs).
It can apply weights to reach a composite score
StackScribe marked this conversation as resolved.
Show resolved Hide resolved
about the health of the deployment,
similar to what the Keptn v1 quality gates provided.
The data used can come from multiple instances
StackScribe marked this conversation as resolved.
Show resolved Hide resolved
of multiple data providers
(such as Prometheus, Dynatrace, and DataDog).

A Keptn analysis can be run for any application running anywhere
as long Keptn can access a monitoring provider endpoint
that serves metrics for the application.
You can point to multiple instances of the supported monitoring providers
(Prometheus, Dynatrace, Datadog, and dql)
so the application itself can run anywhere,

StackScribe marked this conversation as resolved.
Show resolved Hide resolved
To implement a Keptn analysis for your deployment:

- Create a `KeptnMetricProvider` resource
for each data source to be used for your analysis.
This specifies the URL for the data source,
assigns a `name` that Keptn uses to reference that provider,
and can define a secret for the data provider if necessary.

- Create `ValueTemplate` resources for each SLI
and `AnalysisDefinition` resources for each SLO
StackScribe marked this conversation as resolved.
Show resolved Hide resolved
to be used in your analysis
StackScribe marked this conversation as resolved.
Show resolved Hide resolved

- Create and apply an `Analysis` resource
to define each specific analysis you want to run.

See the
[Analysis](../guides/slo.md)
guide and the
[Analyzing Application Performance with Keptn](https://keptn.sh/latest/blog/2023/12/19/analyzing-application-performance-with-keptn/)
blog
for more details and examples for the Keptn analysis feature.