import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
task_id_list = client.cloud.k8s.clusters.pools.create(
cluster_name="my-cluster",
project_id=1,
region_id=7,
flavor_id="g1-standard-1-2",
min_node_count=3,
name="my-pool",
)
print(task_id_list.tasks)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
taskIDList, err := client.Cloud.K8S.Clusters.Pools.New(
context.TODO(),
"my-cluster",
cloud.K8SClusterPoolNewParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(7),
FlavorID: "g1-standard-1-2",
MinNodeCount: 3,
Name: "my-pool",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskIDList.Tasks)
}
curl --request POST \
--url https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"flavor_id": "g1-standard-1-2",
"min_node_count": 3,
"name": "my-pool",
"auto_healing_enabled": true,
"boot_volume_size": 50,
"boot_volume_type": "ssd_hiiops",
"crio_config": {
"default-ulimits": "nofile=1024:2048"
},
"is_public_ipv4": true,
"kubelet_config": {
"podMaxPids": "4096"
},
"labels": {
"my-label": "foo"
},
"max_node_count": 5,
"security_group_ids": [
"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce"
],
"taints": {
"my-taint": "bar:NoSchedule"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
flavor_id: 'g1-standard-1-2',
min_node_count: 3,
name: 'my-pool',
auto_healing_enabled: true,
boot_volume_size: 50,
boot_volume_type: 'ssd_hiiops',
crio_config: {'default-ulimits': 'nofile=1024:2048'},
is_public_ipv4: true,
kubelet_config: {podMaxPids: '4096'},
labels: {'my-label': 'foo'},
max_node_count: 5,
security_group_ids: ['e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce'],
taints: {'my-taint': 'bar:NoSchedule'}
})
};
fetch('https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flavor_id' => 'g1-standard-1-2',
'min_node_count' => 3,
'name' => 'my-pool',
'auto_healing_enabled' => true,
'boot_volume_size' => 50,
'boot_volume_type' => 'ssd_hiiops',
'crio_config' => [
'default-ulimits' => 'nofile=1024:2048'
],
'is_public_ipv4' => true,
'kubelet_config' => [
'podMaxPids' => '4096'
],
'labels' => [
'my-label' => 'foo'
],
'max_node_count' => 5,
'security_group_ids' => [
'e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce'
],
'taints' => [
'my-taint' => 'bar:NoSchedule'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flavor_id\": \"g1-standard-1-2\",\n \"min_node_count\": 3,\n \"name\": \"my-pool\",\n \"auto_healing_enabled\": true,\n \"boot_volume_size\": 50,\n \"boot_volume_type\": \"ssd_hiiops\",\n \"crio_config\": {\n \"default-ulimits\": \"nofile=1024:2048\"\n },\n \"is_public_ipv4\": true,\n \"kubelet_config\": {\n \"podMaxPids\": \"4096\"\n },\n \"labels\": {\n \"my-label\": \"foo\"\n },\n \"max_node_count\": 5,\n \"security_group_ids\": [\n \"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce\"\n ],\n \"taints\": {\n \"my-taint\": \"bar:NoSchedule\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flavor_id\": \"g1-standard-1-2\",\n \"min_node_count\": 3,\n \"name\": \"my-pool\",\n \"auto_healing_enabled\": true,\n \"boot_volume_size\": 50,\n \"boot_volume_type\": \"ssd_hiiops\",\n \"crio_config\": {\n \"default-ulimits\": \"nofile=1024:2048\"\n },\n \"is_public_ipv4\": true,\n \"kubelet_config\": {\n \"podMaxPids\": \"4096\"\n },\n \"labels\": {\n \"my-label\": \"foo\"\n },\n \"max_node_count\": 5,\n \"security_group_ids\": [\n \"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce\"\n ],\n \"taints\": {\n \"my-taint\": \"bar:NoSchedule\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}Create k8s cluster pool
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
task_id_list = client.cloud.k8s.clusters.pools.create(
cluster_name="my-cluster",
project_id=1,
region_id=7,
flavor_id="g1-standard-1-2",
min_node_count=3,
name="my-pool",
)
print(task_id_list.tasks)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
taskIDList, err := client.Cloud.K8S.Clusters.Pools.New(
context.TODO(),
"my-cluster",
cloud.K8SClusterPoolNewParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(7),
FlavorID: "g1-standard-1-2",
MinNodeCount: 3,
Name: "my-pool",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskIDList.Tasks)
}
curl --request POST \
--url https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"flavor_id": "g1-standard-1-2",
"min_node_count": 3,
"name": "my-pool",
"auto_healing_enabled": true,
"boot_volume_size": 50,
"boot_volume_type": "ssd_hiiops",
"crio_config": {
"default-ulimits": "nofile=1024:2048"
},
"is_public_ipv4": true,
"kubelet_config": {
"podMaxPids": "4096"
},
"labels": {
"my-label": "foo"
},
"max_node_count": 5,
"security_group_ids": [
"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce"
],
"taints": {
"my-taint": "bar:NoSchedule"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
flavor_id: 'g1-standard-1-2',
min_node_count: 3,
name: 'my-pool',
auto_healing_enabled: true,
boot_volume_size: 50,
boot_volume_type: 'ssd_hiiops',
crio_config: {'default-ulimits': 'nofile=1024:2048'},
is_public_ipv4: true,
kubelet_config: {podMaxPids: '4096'},
labels: {'my-label': 'foo'},
max_node_count: 5,
security_group_ids: ['e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce'],
taints: {'my-taint': 'bar:NoSchedule'}
})
};
fetch('https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flavor_id' => 'g1-standard-1-2',
'min_node_count' => 3,
'name' => 'my-pool',
'auto_healing_enabled' => true,
'boot_volume_size' => 50,
'boot_volume_type' => 'ssd_hiiops',
'crio_config' => [
'default-ulimits' => 'nofile=1024:2048'
],
'is_public_ipv4' => true,
'kubelet_config' => [
'podMaxPids' => '4096'
],
'labels' => [
'my-label' => 'foo'
],
'max_node_count' => 5,
'security_group_ids' => [
'e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce'
],
'taints' => [
'my-taint' => 'bar:NoSchedule'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flavor_id\": \"g1-standard-1-2\",\n \"min_node_count\": 3,\n \"name\": \"my-pool\",\n \"auto_healing_enabled\": true,\n \"boot_volume_size\": 50,\n \"boot_volume_type\": \"ssd_hiiops\",\n \"crio_config\": {\n \"default-ulimits\": \"nofile=1024:2048\"\n },\n \"is_public_ipv4\": true,\n \"kubelet_config\": {\n \"podMaxPids\": \"4096\"\n },\n \"labels\": {\n \"my-label\": \"foo\"\n },\n \"max_node_count\": 5,\n \"security_group_ids\": [\n \"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce\"\n ],\n \"taints\": {\n \"my-taint\": \"bar:NoSchedule\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flavor_id\": \"g1-standard-1-2\",\n \"min_node_count\": 3,\n \"name\": \"my-pool\",\n \"auto_healing_enabled\": true,\n \"boot_volume_size\": 50,\n \"boot_volume_type\": \"ssd_hiiops\",\n \"crio_config\": {\n \"default-ulimits\": \"nofile=1024:2048\"\n },\n \"is_public_ipv4\": true,\n \"kubelet_config\": {\n \"podMaxPids\": \"4096\"\n },\n \"labels\": {\n \"my-label\": \"foo\"\n },\n \"max_node_count\": 5,\n \"security_group_ids\": [\n \"e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce\"\n ],\n \"taints\": {\n \"my-taint\": \"bar:NoSchedule\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Project ID
1
Region ID
7
Cluster name
"my-cluster"
Body
Flavor ID
"g1-standard-1-2"
Minimum node count
1 <= x <= 2003
Pool's name
1 - 20^[a-z][a-z0-9\-]{0,18}[a-z0-9]$"my-pool"
Enable auto healing
true
Boot volume size
10 <= x <= 200050
Boot volume type
cold, ssd_hiiops, ssd_local, ssd_lowlatency, standard, ultra "ssd_hiiops"
Cri-o configuration for pool nodes
Show child attributes
Show child attributes
{ "default-ulimits": "nofile=1024:2048" }
Enable public v4 address
true
Kubelet configuration for pool nodes
Show child attributes
Show child attributes
{ "podMaxPids": "4096" }
Labels applied to the cluster pool
Show child attributes
Show child attributes
{ "my-label": "foo" }
Maximum node count
1 <= x <= 2005
Security group IDs applied to the cluster pool nodes
["e6ea8f35-82ce-4fb2-b51c-6a24a3a23bce"]
Server group policy: anti-affinity, soft-anti-affinity or affinity
affinity, anti-affinity, soft-anti-affinity Taints applied to the cluster pool
Show child attributes
Show child attributes
{ "my-taint": "bar:NoSchedule" }
Response
OK
List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:
GET /v1/tasks/{task_id}- Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
["d478ae29-dedc-4869-82f0-96104425f565"]
Was this page helpful?