Knative
Knative is an open-source community project, which enhances Kubernetes by introducing components that facilitate the deployment, execution, and administration of serverless, cloud-native applications.
Using Port's Kubernetes Exporter, you can keep track of the Knative resources across your different clusters and export all of the data to Port. You will use built in metadata from your kubernetes resources and CRDs to create Entities in Port and keep track of their state.
Get to know the basics of our Kubernetes exporter here!
Prerequisitesโ
- Helm must be installed to use the chart. Please refer to Helm's documentation to get started;
- The
jq
command must installed; - The
yq
command must installed; - The
kubectl
command must be installed; - Have your Port credentials ready.
In this use-case, you will use a custom bash script which will assist you in the process of installing Port's K8s exporter.
For more information about the k8s exporter installation script click here!
The script will install the helm chart to the Kubernetes cluster which is currently in kubectl context. To view the context name of the cluster the exporter will be installed on, run:
kubectl config current-context
Setting up your blueprintsโ
Creating Blueprints using the installation scriptโ
The installation script provides a convenient way to create your blueprints. Using the CUSTOM_BP_PATH
environment variable, you can fetch a pre-defined blueprints.json
to create your blueprints. For this use-case, you will use this file to define your blueprints. Do this by running:
export CUSTOM_BP_PATH="https://raw.githubusercontent.com/port-labs/template-assets/main/kubernetes/blueprints/kubernetes_knative_usecase.json"
This blueprints.json
file defines the following blueprints:
- Cluster;
- Namespace;
- Node;
- Pod;
- Workload *;
- Knative Service;
- Knative Configuration;
- Knative Revision;
- Knative Route.
Workload
is an abstraction of Kubernetes objects which create and manage pods. By creating this blueprint, you can avoid creating a dedicated blueprint per Workload type, all of which will likely look pretty similar. Here is the list of kubernetes objectsWorkload
will represent:
- Deployment;
- ReplicaSet;
- StatefulSet;
- DaemonSet.
Exporting your Kubernetes clusterโ
Installing the Kubernetes exporter using the scriptโ
Using the CONFIG_YAML_URL
parameter, you can define a custom config.yaml
to use when installing the exporter.
In this use-case you will be using this configuration file. To achieve this, run:
export CONFIG_YAML_URL="https://raw.githubusercontent.com/port-labs/template-assets/main/kubernetes/full-configs/kubernetes_kantive_usecase.yaml"
You can now run the installation script using the following code snippet:
export CLUSTER_NAME="my-cluster"
export PORT_CLIENT_ID="my-port-client-id"
export PORT_CLIENT_SECRET="my-port-client-secret"
curl -s https://raw.githubusercontent.com/port-labs/template-assets/main/kubernetes/install.sh | bash
You can now browse to your Port environment to see that your blueprints have been created, and your k8s and Knative resources are being reported to Port using the freshly installed k8s exporter.