JavaScript SDK
Kubernetes
Kubernetes clusters and templates
12 methods
listKubernetesClusters()
List Kubernetes clusters
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by cluster status
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.listKubernetesClusters();console.log(result);
createKubernetesCluster()
Create Kubernetes cluster
Parameters
namestring
requiredcluster_template_idstring
requiredkeypairstring
- SSH keypair name
docker_volume_sizeinteger
- Docker volume size in GB
labelsobject
master_flavor_idstring
flavor_idstring
master_countinteger
node_countinteger
create_timeoutinteger
fixed_networkstring
fixed_subnetstring
floating_ip_enabledboolean
master_lb_enabledboolean
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.createKubernetesCluster({name: "production-cluster",cluster_template_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
getKubernetesCluster()
Get Kubernetes cluster
Parameters
cluster_idstring
required- Kubernetes Cluster ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.getKubernetesCluster({cluster_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
updateKubernetesCluster()
Update Kubernetes cluster
Parameters
cluster_idstring
required- Kubernetes Cluster ID
node_countinteger
- New worker node count (for scaling)
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.updateKubernetesCluster({cluster_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
deleteKubernetesCluster()
Delete Kubernetes cluster
Parameters
cluster_idstring
required- Kubernetes Cluster ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.deleteKubernetesCluster({cluster_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
getKubernetesClusterKubeconfig()
Get cluster kubeconfig
Parameters
cluster_idstring
required- Kubernetes Cluster ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.getKubernetesClusterKubeconfig({cluster_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
resizeKubernetesCluster()
Resize Kubernetes cluster
Parameters
cluster_idstring
required- Kubernetes Cluster ID
node_countinteger
required- New worker node count
nodes_to_removearray
- Specific nodes to remove (by name)
nodegroupstring
- Node group to resize
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.resizeKubernetesCluster({cluster_id: "550e8400-e29b-41d4-a716-446655440000",node_count: 10});console.log(result);
listKubernetesTemplates()
List cluster templates
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
coestring
- Filter by container orchestration engine
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.listKubernetesTemplates();console.log(result);
createKubernetesTemplate()
Create cluster template
Parameters
namestring
requiredcoestring
requiredimage_idstring
requiredkeypair_idstring
external_network_idstring
requiredfixed_networkstring
fixed_subnetstring
dns_nameserverstring
docker_storage_driverstring
docker_volume_sizeinteger
volume_driverstring
network_driverstring
http_proxystring
https_proxystring
no_proxystring
labelsobject
master_flavor_idstring
flavor_idstring
server_typestring
registry_enabledboolean
insecure_registrystring
floating_ip_enabledboolean
master_lb_enabledboolean
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.createKubernetesTemplate({name: "example-string",coe: "kubernetes",image_id: "550e8400-e29b-41d4-a716-446655440000",external_network_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
getKubernetesTemplate()
Get cluster template
Parameters
cluster_template_idstring
required- Kubernetes Cluster Template ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.getKubernetesTemplate({cluster_template_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
updateKubernetesTemplate()
Update cluster template
Parameters
cluster_template_idstring
required- Kubernetes Cluster Template ID
namestring
labelsobject
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.updateKubernetesTemplate({cluster_template_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);
deleteKubernetesTemplate()
Delete cluster template
Parameters
cluster_template_idstring
required- Kubernetes Cluster Template ID
Example
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.kubernetes.deleteKubernetesTemplate({cluster_template_id: "550e8400-e29b-41d4-a716-446655440000"});console.log(result);