Provision a Kubernetes Cluster - How to
On this page you will learn how to setup an edge system with a generic Kubernetes cluster using the cluster installation tools in the Kelvin UI.
If you want Kelvin to be responsible to also install the Kubernetes cluster directly and handle all the management of the cluster, you can choose the K3S option.
Kubernetes
Kubernetes is an open-source platform that automates the deployment, scaling, and management of containerized Kelvin SmartApps™. It enables portability, efficient resource utilization, and provides features for rolling updates, self-healing, and service discovery.
It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF).
Requirements & Limitations
Cloud Kubernetes implementations vary across providers, and even within the same provider, there can be different types of stacks based on the selected services.
So it is not possible to list all the requirements, limitations and fixed design options available and will heavily depend on your project and budgets.
When setting up your Kubernetes cluster here are some links to the Kubernetes documentation that can help you decide what type of setup to implement.
Installation
The installation process is very simple and you can have your new Kelvin Cluster cluster up and running within ten minutes depending on your internet speed.
Setup Kubernetes Cluster
To start you need to setup your own Kubernetes cluster. There are four basic steps to installing and setting up Kubernetes clusters;
- Prepare Infrastructure: Set up a group of machines (physical or virtual) to run Kubernetes nodes.
- Install Kubernetes on Each Node: Use a tool like kubeadm, Minikube, or Kops to install Kubernetes on each machine. One machine will act as the master node, and others as worker nodes.
- Initialize the Cluster: On the master node, initialize the Kubernetes cluster.
- Join Worker Nodes: Use a command provided during initialization to join the worker nodes to the cluster.
Kuberenetes documentation website has a getting started guide for achieving all these steps; https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/
Install Cluster
To start, go to the Orchestration page and click on the Register Cluster button;
Then in the popup options, select Kubernetes and type in a display name and optionally a name ID for this new kubernetes cluster.
| Display Name | This can be any characters and spaces that gives your cluster a memorable name for reference |
| Name ID | A unique lower-case alphanumeric name which uniquely identifies this cluster. This will be automatically filled in when you type the Display Name. Normally you do not need to change unless the Name ID clashes with another cluster's Name ID. |
The Name ID is the unique identifier name for the cluster. This must contain only lowercase alphanumeric characters. The ., _ and - characters are also allowed to separate words instead of a space BUT can not be at the beginning or end of the name.
You can then download the manifest YAML file and then run the CLI command in your Kubernetes environment.
Make sure the manifest YAML file is locally accessible to the kubectl command.
The actual CLI command is;
kubectl apply --server-side -f kelvin.yaml
Congratulations, after a few minutes depending on your Internet speed your new cluster is ready for use.
curl -X "POST" \
"https://<url.kelvin.ai>/api/v4/orchestration/clusters/create" \
-H "Authorization: Bearer <Your Current Token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "doc-demo-cluster-kubernetes",
"title": "Doc Demo Cluster Kubernetes",
"type": "kubernetes"
}'
The response will look something like this;
{
"name":"doc-demo-cluster-kubernetes",
"title":"Doc Demo Cluster Kubernetes",
"type":"kubernetes",
"ready":false,
"status":"pending_provision",
"last_seen":null,
"sync_scrape_interval":120,
"manifests_scrape_interval":130,
"manifests_scrape_enabled":false,
"version":{
"k8s_version":"",
"kelvin_version":""
},
"created":"2024-05-23T14:12:45.798357Z",
"updated":"2024-05-23T14:12:45.798357Z",
"service_account_token":"bm9kZS1jbGllbnQtZG9jLWRlbW8tY2x1c3Rlci1rdWJlcm5ldGVzOjZyellHbURuTVBpVzUySkt1YmM3b1RlMVpxajhBOVUz",
"provision_script":"kubectl apply --server-side -f kelvin.yaml",
"join_script":"",
"telemetry_scrape_interval":110,
"telemetry_enabled":false,
"telemetry_buffer_size":10,
"forward_logs_enabled":false,
"forward_logs_buffer_size":10,
"upgrade_status":{
"state":"idle",
"message":""
},
"upgrade_pre_download":false,
"upgrade_instantly_apply":true
}
You can then get the manifest YAML file that is mentioned in the provision script with the API request;
curl -X "GET" \
"https://<url.kelvin.ai>/api/v4/orchestration/clusters/doc-demo-cluster-kubernetes/provision/get" \
-H "Authorization: Bearer <Your Current Token>" \
-H "Accept: application/json"
which will give a YAML response starting like this;
kind: Namespace
apiVersion: v1
metadata:
name: kelvin-admin
---
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
name: kelvin-certificate
namespace: kelvin-admin
labels:
app.kubernetes.io/part-of: kelvin
data:
ca.crt:
...
Copy and paste this into a file called kelvin.yaml and then run the CLI command given in the key provision_script in your Kubernetes environment.
Make sure the manifest YAML file is locally accessible to the kubectl command.
The actual CLI command is;
kubectl apply --server-side -f kelvin.yaml
Congratulations, after a few minutes depending on your Internet speed your new cluster is ready for use.
from kelvin.api.client import Client
# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")
# Set or Update the Default Cluster in an Instance
response = client.orchestration.create_orchestration_clusters(data={
"name": "doc-demo-cluster-kubernetes",
"title": "Doc Demo Cluster Kubernetes",
"type": "kubernetes"
})
print(response)
You can save the manifest YAML file that is mentioned in the provision script with;
kelvin_yaml = client.orchestration.get_orchestration_clusters_provision(cluster_name=response.name)
with open("kelvin.yaml", 'w') as file:
file.write(str(kelvin_yaml))
Make sure the manifest YAML file is locally accessible to the kubectl command.
And then run the CLI command given in the key provision_script in your Kubernetes environment. The actual CLI command is;
kubectl apply --server-side -f kelvin.yaml
Congratulations, after a few minutes depending on your Internet speed your new cluster is ready for use.



