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

PORT-12408 Visualize your services' k8s runtime refactor #1938

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/guides/all/import-and-manage-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ In this example we'll use the Import State feature of Terraform, then manage our

## Prerequisites

You will need to create an integration within the Port UI, For example the [Kubernetes Exporter](/guides/all/visualize-service-k8s-runtime)
You will need to create an integration within the Port UI, For example the [Kubernetes Exporter](/guides/all/visualize-repository-k8s-runtime
)

:::note Installation Id
As you create the integration, take note of the installation Id.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/all/manage-resources-using-k8s-crds.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ By leveraging the power of the K8s API extensions, platform engineers can keep u

### Next Steps

- Enrich the catalog and visualize the Runtime existing objects in your K8s cluster, by following the [Visualize services' k8s runtime guide](./visualize-service-k8s-runtime.md).
- Enrich the catalog and visualize the Runtime existing objects in your K8s cluster, by following the [Visualize services' k8s runtime guide](./visualize-repository-k8s-runtime).
- Port allows multiple ways to enhance the experience of executing `Actions`, feel free to alter the `Action` in Port to your needs by visiting [Action Documentation](/actions-and-automations/create-self-service-experiences/create-self-service-experiences.md).
- [Sync data](/build-your-software-catalog/sync-data-to-catalog/sync-data-to-catalog.md) and create more `Blueprints` to enrich the data beyond what exists in K8S.
- Build dashboards and reports to visualize the usage of the CRDs and resources in your K8s cluster by following the [Build dashboards and reports guide](/customize-pages-dashboards-and-plugins/dashboards/dashboards.md).
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
sidebar_position: 4
displayed_sidebar: null
description: Learn how to visualize Kubernetes service runtime in Port, improving monitoring and management of your cloud-native applications.
description: Learn how to visualize Kubernetes repository runtime in Port, improving monitoring and management of your cloud-native applications.
---

import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import PortTooltip from "/src/components/tooltip/tooltip.jsx"
import PortApiRegionTip from "/docs/generalTemplates/_port_region_parameter_explanation_template.md"

# Visualize your services' k8s runtime
# Visualize your repositories' k8s runtime

This guide takes 10 minutes to complete, and aims to demonstrate the value of Port's integration with Kubernetes.

:::info Prerequisites

- This guide assumes you have a Port account and that you have finished the [onboarding process](/quickstart). We will use the `Service` blueprint that was created during the onboarding process.
- This guide assumes you have a Port account and that you have installed any of Port's [Git Integrations](/build-your-software-catalog/sync-data-to-catalog/git/). We will use the `Repository` blueprint that was created during the installation process
- You will need an accessible k8s cluster. If you don't have one, here is how to quickly set-up a [minikube cluster](https://minikube.sigs.k8s.io/docs/start/).
- [Helm](https://helm.sh/docs/intro/install/) - required to install Port's Kubernetes exporter.

Expand Down Expand Up @@ -92,11 +92,11 @@ After installation, the exporter will:

<br/>

### Define the connection between services and workloads
### Define the connection between repositories and workloads

Now that we have our <PortTooltip id="blueprint">blueprints</PortTooltip> set up, we want to model the logical connection between them by relating the `Workload` blueprint to the `Service` blueprint. This will grant us some helpful context in our Software catalog, allowing us to see relevant `Workloads` in a `Service`'s context, or a `Service`'s property directly in its corresponding `Workload`.

In this guide we will create one relation named `service` which will represent the service that a workload is running.
In this guide we will create one relation named `repository` which will represent the service that a workload is running.

1. Go to your [Builder](https://app.getport.io/settings/data-model), expand the `Workload` blueprint, and click on `New relation`.

Expand All @@ -106,21 +106,21 @@ In this guide we will create one relation named `service` which will represent t

<br/><br/>

### Map your workloads to their services
### Map your workloads to their repositories

You may have noticed that the `service` relations are empty for all of our `workloads`. This is because we haven't specified which `workload` belongs to which `service`. This can be done manually, or via mapping by using a convention of your choice.
You may have noticed that the `repository` relations are empty for all of our `workloads`. This is because we haven't specified which `workload` belongs to which `repository`. This can be done manually, or via mapping by using a convention of your choice.

In this guide we will use the following convention:
A `workload` with a label in the form of `portService: <service-identifier>` will automatically be assigned to a `service` with that identifier.
A `workload` with a label in the form of `portRepository: <repository-identifier>` will automatically be assigned to a `repository` with that identifier.

For example, a k8s deployment with the label `portService: myService` will be assigned to a `service` with the identifier `myService`.
For example, a k8s deployment with the label `portRepository: myRepository` will be assigned to a `repository` with the identifier `myRepository`.

We achieved this by adding a [mapping definition](https://github.com/port-labs/template-assets/blob/main/kubernetes/full-configs/k8s-guide/k8s_guide_config.yaml#L111-L119) in the configuration YAML we used when installing the exporter. The definition uses `jq` to perform calculations between properties.

**Let's see this in action:**

1. Create a `Deployment` resource in your cluster with a label matching the identifier of a `service` in your [Software catalog](https://app.getport.io/services).
You can use the simple example below and change the `metadata.labels.portService` value to match your desired `service`. Copy it into a file named `deployment.yaml`, then apply it:
1. Create a `Deployment` resource in your cluster with a label matching the identifier of a `repository` in your [Software catalog](https://app.getport.io/services).
You can use the simple example below and change the `metadata.labels.portRepository` value to match your desired `repository`. Copy it into a file named `deployment.yaml`, then apply it:

```bash
kubectl apply -f deployment.yaml
Expand All @@ -133,10 +133,10 @@ kubectl apply -f deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: awesomeservice
name: awesomerepository
labels:
app: nginx
portService: AwesomeService
portRepository: AwesomeRepository
spec:
replicas: 2
selector:
Expand Down Expand Up @@ -177,13 +177,13 @@ resources:
"my-cluster"
properties: {}
relations:
service: .metadata.labels.portService
repository: .metadata.labels.portRepository
title: .metadata.name
```

<br/>

3. Go to your [Software catalog](https://app.getport.io/services), and click on `Workloads`. Click on the `Workload` for which you created the deployment, and you should see the `service` relation filled.
3. Go to your [Software catalog](https://app.getport.io/repositories), and click on `Workloads`. Click on the `Workload` for which you created the deployment, and you should see the `repository` relation filled.

<img src='/img/guides/k8sEntityAfterIngestion.png' width='80%' />

Expand Down
6 changes: 3 additions & 3 deletions src/components/guides-section/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ export const availableGuides = [
link: "/guides/all/create-cloud-resource-using-iac",
},
{
title: "Visualize your services' k8s runtime",
description: "Create views to track the health, status, and other standards of your services' k8s runtime",
title: "Visualize your repositories' k8s runtime",
description: "Create views to track the health, status, and other standards of your repositories' k8s runtime",
tags: ["K8s for devs", "Actions", "Dashboards", "Scorecards"],
logos: ["Kubernetes" ],
category: "Getting started",
link: "/guides/all/visualize-service-k8s-runtime",
link: "/guides/all/visualize-repository-k8s-runtime",
},
{
title: "Visualize your services' k8s runtime using ArgoCD",
Expand Down
Binary file modified static/img/guides/createServiceRelation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/guides/k8sEntityAfterIngestion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading