Kubeless
Kubeless is a Kubernetes-native, Serverless Framework that enables users to develop advanced applications with functions on top of Kubernetes clusters. Kubeless allows developers to deploy functions (small bits of code) without having to worry about the underlying infrastructure. It is designed to be deployed on top of a Kubernetes cluster and take advantage of all the great Kubernetes primitives.
What Will You Do¶
In this exercise,
- You will create a "kubeless" addon and use it in a custom cluster blueprint
- You will then apply this cluster blueprint to a managed cluster
Important
This tutorial describes the steps to create and use a custom cluster blueprint using the Web Console. The entire workflow can also be fully automated and embedded into an automation pipeline.
Assumptions¶
- You have already provisioned or imported one or more Kubernetes clusters using the controller.
Step 1: Download YAML¶
Navigate to Kubeless' official repository and download the k8s yaml file "kubeless-vX.Y.Z.yaml" for the latest release. In this example, we used v1.0.7 of Kubeless.
Step 2: Create Addon¶
- Login into the Web Console and navigate to your Project as an Org Admin or Infrastructure Admin
- Under Infrastructure, select "Namespaces" and create a new namespace called "kubeless"
- Select "Addons" and "Create" a new Addon called "kubeless"
- Ensure that you select "YAML" for type and select the namespace as "kubeless"
- Provide the "kubeless-v1.0.7.yaml" from the previous step and Save
Once the addon is created, ensure you publish it and optionally provide a version so that it can be tracked.
Step 3: Create Blueprint¶
Now, we are ready to assemble a custom cluster blueprint using this addon.
- Under Infrastructure, select "Blueprints"
- Create a new blueprint and give it a name such as "faas" (functions as a service)
- Ensure that you have the managed Ingress enabled in case your applications require Ingress
Once the blueprint is created, ensure you publish it and optionally provide a version so that it can be tracked.
Step 4: Apply Blueprint¶
Now, we are ready to apply this custom blueprint to a cluster.
- Click on Options for the target Cluster in the Web Console
- Select "Update Blueprint" and select the "faas" blueprint we created from the list
Click on "Save and Publish". This will start the deployment of the addons configured in the "faas" blueprint to the targeted cluster. The blueprint sync process can take a few minutes. Once complete, the cluster will display the current cluster blueprint details and whether the sync was successful or not. See illustrative example below.
Step 6: Verify Deployment¶
Users can optionally verify whether the correct resources have been created on the cluster.
- Click on the Kubectl button on the cluster to open a virtual terminal
- First, we will verify if the cert-manager namespace has been created
kubectl get ns kubeless
NAME STATUS AGE
kubeless Active 9m32s
- Next, we will verify the pods in the "kubeless" namespace. You should see something like the example below.
kubectl get po -n kubeless
NAME READY STATUS RESTARTS AGE
kubeless-controller-manager-7ccdccb78b-4v8c4 3/3 Running 0 9m33s
Kubeless creates a number of Custom Resources-CRDs on the cluster. You can view them by issuing the following command from the KubeCTL CLI utility.
kubectl get crd |grep kubeless
NAME CREATED AT
cronjobtriggers.kubeless.io 2020-08-12T21:40:45Z
functions.kubeless.io 2020-08-12T21:40:40Z
httptriggers.kubeless.io 2020-08-12T21:40:42Z
Recap¶
Congratulations! You have successfully created a custom cluster blueprint with the "kubeless" addon and applied to a cluster. You can now use this blueprint on as many clusters as you require.