Deploying a Hello World with the OVHcloud API
Find out how to set-up your Kubernetes cluster and deploy a Hello World application inside it with the OVHcloud API
Find out how to set-up your Kubernetes cluster and deploy a Hello World application inside it with the OVHcloud API
Last updated 16th January 2023
Follow this quickstart guide to deploy a containerised Hello World application on your OVHcloud Managed Kubernetes Service cluster, using the OVHcloud API.
In this guide, we are assuming you're using the OVHcloud API to manage your Kubernetes cluster. If you are using a different method, like the OVHcloud Control Panel, please take a look to the Deploying a Hello World application with the OVHcloud Control Panel guide.
This guide assumes you are familiar with the OVHcloud API. If you have never used it, you can find the basics here: First steps with the OVHcloud API.
To simplify things, we are using the API Explorer, which allows to explore, learn and interact with the API in an interactive way.
Log in to the API Explorer using your OVH NIC.
If you go to the Kubernetes section of the API Explorer, you will see the available endpoints:
The GET /cloud/project/{serviceName}/kube
API endpoint lists all the available Kubernetes clusters:
Result:
[
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
]
By calling it, you can view a list of values. Note down the ID of the cluster you want to use. In this example, we will refer to it as kubeId
.
The GET /cloud/project/{serviceName}/kube/{kubeId}
API endpoint provides important information about your Managed Kubernetes cluster, including its region, status and URL.
Result:
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"region": "GRA5",
"name": "my-tiny-cluster",
"url": "xxxxxx.c2.gra.k8s.ovh.net",
"nodesUrl": "xxxxxx.nodes.c2.gra.k8s.ovh.net",
"version": "1.24.8-1",
"nextUpgradeVersions": [
"1.25"
],
"customization": {
"apiServer": {
"admissionPlugins": {
"enabled": [
"AlwaysPullImages",
"NodeRestriction"
],
"disabled": []
}
}
},
"status": "READY",
"updatePolicy": "ALWAYS_UPDATE",
"isUpToDate": true,
"controlPlaneIsUpToDate": true,
"privateNetworkId": null,
"createdAt": "2022-09-22T06:57:58Z",
"updatedAt": "2022-12-15T15:14:44Z"
}
The first element needed to deploy the Hello World application is a node pool
, a pool of machines, in your cluster. To create this node pool, you can use the POST /cloud/project/{serviceName}/kube/{kubeId}/nodepool
endpoint, which will deploy a node pool for your cluster on the Public Cloud.
You will need to give it several information but only the flavorName
parameter (the flavor of the instance you want to create) is a required parameter. If you don't fill a value for desiredNodes
parameter, the default value will be 1, so you will create a new node pool with one node.
For this tutorial, we choose a general purpose node, such as the b2-7
flavor.
Result:
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"projectId": "",
"name": "nodepool-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"flavor": "b2-7",
"status": "INSTALLING",
"sizeStatus": "CAPACITY_OK",
"autoscale": false,
"monthlyBilled": false,
"antiAffinity": false,
"desiredNodes": 0,
"minNodes": 0,
"maxNodes": 100,
"currentNodes": 0,
"availableNodes": 0,
"upToDateNodes": 0,
"createdAt": "2023-01-13T08:52:27Z",
"updatedAt": "2023-01-13T08:52:27Z",
"autoscaling": {
"scaleDownUtilizationThreshold": 0.5,
"scaleDownUnneededTimeSeconds": 600,
"scaleDownUnreadyTimeSeconds": 1200
},
"template": {
"metadata": {
"labels": {},
"annotations": {},
"finalizers": []
},
"spec": {
"unschedulable": false,
"taints": []
}
}
}
The API will return you the new node pool information.
You can use the GET /cloud/project/{serviceName}/kube/{kubeId}/nodepool
entrypoint to list all your node pools. Look for the node pool you've just created, and verify the status is READY
.
The node pool installation can take a few minutes.
Result:
[
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"projectId": "a123b4c56d789e0ab12c345d678efa12",
"name": "nodepool-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"flavor": "b2-7",
"status": "READY",
"sizeStatus": "CAPACITY_OK",
"autoscale": false,
"monthlyBilled": false,
"antiAffinity": false,
"desiredNodes": 1,
"minNodes": 0,
"maxNodes": 100,
"currentNodes": 1,
"availableNodes": 1,
"upToDateNodes": 1,
"createdAt": "2022-09-22T06:58:09Z",
"updatedAt": "2022-12-15T15:14:33Z",
"autoscaling": {
"scaleDownUtilizationThreshold": 0.5,
"scaleDownUnneededTimeSeconds": 600,
"scaleDownUnreadyTimeSeconds": 1200
},
"template": {
"metadata": {
"labels": {},
"annotations": {},
"finalizers": []
},
"spec": {
"unschedulable": false,
"taints": []
}
}
},
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"projectId": "a123b4c56d789e0ab12c345d678efa12",
"name": "nodepool-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"flavor": "b2-7",
"status": "READY",
"sizeStatus": "CAPACITY_OK",
"autoscale": false,
"monthlyBilled": false,
"antiAffinity": false,
"desiredNodes": 0,
"minNodes": 0,
"maxNodes": 100,
"currentNodes": 0,
"availableNodes": 0,
"upToDateNodes": 0,
"createdAt": "2023-01-13T08:52:27Z",
"updatedAt": "2023-01-13T08:52:39Z",
"autoscaling": {
"scaleDownUtilizationThreshold": 0.5,
"scaleDownUnneededTimeSeconds": 600,
"scaleDownUnreadyTimeSeconds": 1200
},
"template": {
"metadata": {
"labels": {},
"annotations": {},
"finalizers": []
},
"spec": {
"unschedulable": false,
"taints": []
}
}
}
]
Please refer to the Configuring kubectl on an OVHcloud Managed Kubernetes cluster documentation for this part of the process.
You're now ready to deploy your first application in your OVHcloud Managed Kubernetes cluster.
For more details about this process, you can refer to the deploying an application documentation.
As you can see in the Kubernetes section of the API Explorer, a lot of useful API endpoints exist to manage your Kubernetes clusters. Feel free to use the API endpoints depending on your use cases. Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community