CreateCluster#

Description#

Creates a cluster.

The cluster consists of master nodes on which software (e.g. etcd, kubelet, etc.) required for Kubernetes operation is deployed and an optional node with an Ingress controller. Every cluster is deployed on its own set of instances. It usually takes several minutes to create a cluster.

Request Syntax#

POST /clusters HTTP/1.1
Content-type: application/json

{
     "name": "string",
     "kubernetesNetworkConfig": {
           "ipFamily": "string",
           "podIpv4Cidr": "string",
           "serviceIpv4Cidr": "string",
     },
     "resourcesVpcConfig": {
           "securityGroupIds": ["string"],
           "subnetIds": ["string"],
     },
     "tags": {
           "string" : "string"
     },
     "version": "string",
     "remoteAccessConfig": {
         "ec2SshKey": "string",
     },
     "legacyClusterParams": {
           "masterConfig": {
                 "highAvailability": boolean,
                 "mastersInstanceType": "string",
                 "mastersVolumeType": "string",
                 "mastersVolumeSize": number,
                 "mastersVolumeIops": number,
                 "masterPublicIp": "string",
           },
           "ingressConfig": {
                 "ingressRequired": boolean,
                 "ingressPublicIp": "string",
                 "ingressInstanceType": "string",
                 "ingressVolumeType": "string",
                 "ingressVolumeSize": number,
                 "ingressVolumeIops": number,
           },
           "dockerRegistryConfig": {
                 "dockerRegistryRequired": boolean,
                 "dockerRegistryVolumeType": "string",
                 "dockerRegistryVolumeSize": number,
                 "dockerRegistryVolumeIops": number,
           },
           "ebsProviderConfig": {
                 "ebsProviderRequired": boolean,
                 "ebsUser": "string",
           },
           "userDataConfig": {
                 "userData": "string",
                 "userDataContentType": "string",
           }
     }
}

Request Parameters#

Required parameters#

  • name — The cluster name.

    • Type: String

    • Required: Yes

  • resourcesVpcConfig — The VPC configuration that the Kubernetes cluster uses.

  • version — The Kubernetes server version used to deploy the cluster.

    • Type: String

    • Required: Yes

    • Valid values: 1.30.2 | 1.29.4 | 1.28.9 | 1.27.3 | 1.26.6 | 1.25.11

Optional parameters#

  • kubernetesNetworkConfig — The Kubernetes network configuration for the cluster.

  • legacyClusterParams — The parameters for fine-tuning Kubernetes cluster.

  • remoteAccessConfig — The remote access configuration for the managed node group.

Response Syntax#

POST /clusters HTTP/1.1
Content-type: application/json

{
   "cluster": {
      "name": "string",
      "createdAt": number,
      "version": "string",
      "status": "string",
      "resourcesVpcConfig": {
         "securityGroupIds": [ "string" ],
         "subnetIds": [ "string" ],
         "vpcId": "string"
      },
      "certificateAuthority": {
         "data": "string",
      },
      "remoteAccessConfig": {
         "ec2SshKey": "string",
      },
      "kubernetesNetworkConfig": {
         "ipFamily": "string",
         "serviceIpv4Cidr": "string",
         "podIpv4Cidr": "string",
      },
      "health": {
         "issues": [
            {
               "code": "string",
               "message": "string",
               "resourceIds": [ "string" ]
            }
         ]
      },
      "platformVersion": "string",
      "legacyClusterParams": {
           "masterConfig": {
                 "highAvailability": boolean,
                 "mastersInstanceType": "string",
                 "mastersVolumeType": "string",
                 "mastersVolumeSize": number,
                 "mastersVolumeIops": number,
                 "masterPublicIp": "string",
           },
           "ingressConfig": {
                 "ingressRequired": boolean,
                 "ingressPublicIp": "string",
                 "ingressInstanceType": "string",
                 "ingressVolumeType": "string",
                 "ingressVolumeSize": number,
                 "ingressVolumeIops": number,
           },
           "dockerRegistryConfig": {
                 "dockerRegistryRequired": boolean,
                 "dockerRegistryVolumeType": "string",
                 "dockerRegistryVolumeSize": number,
                 "dockerRegistryVolumeIops": number,
           },
           "ebsProviderConfig": {
                 "ebsProviderRequired": boolean,
                 "ebsUser": "string",
           },
           "userDataConfig": {
                 "userData": "string",
                 "userDataContentType": "string",
           }
      },
      "tags": {
         "string" : "string"
      },
   }
}

Response Elements#

  • cluster — Describes the cluster.

Examples#

Amazon boto3
import boto3

session = boto3.Session(
   aws_access_key_id="<AWS_ACCESS_KEY_ID>",
   aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
   region_name="",
)

eks_client = session.client(
   'eks',
   endpoint_url='https://eks.k2.cloud/',
)

eks_client.create_cluster(
    name="production",
    version="1.25.11",
    remoteAccessConfig={"ec2SshKey": "production"},
    resourcesVpcConfig={
        "securityGroupIds": ["sg-C46E1CB8"],
        "subnetIds": ["subnet-F2276B20"],
    },
    kubernetesNetworkConfig={
        "ipFamily": "ipv4",
        "serviceIpv4Cidr": "10.96.0.0/12",
        "podIpv4Cidr": "10.244.0.0/16",
    }
)
boto3 K2 Cloud boto3 Client
import boto3

session = boto3.Session(
   aws_access_key_id="<AWS_ACCESS_KEY_ID>",
   aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
   region_name="",
)

eks_client = session.client(
   'eks',
   endpoint_url='https://eks.k2.cloud/',
)

eks_client.create_cluster(
    name="production",
    version="1.25.11",
    remoteAccessConfig={"ec2SshKey": "production"},
    resourcesVpcConfig={
        "securityGroupIds": ["sg-C46E1CB8"],
        "subnetIds": ["subnet-F2276B20"],
    },
    kubernetesNetworkConfig={
        "ipFamily": "ipv4",
        "serviceIpv4Cidr": "10.96.0.0/12",
        "podIpv4Cidr": "10.244.0.0/16",
    },
    legacyClusterParams={
        "masterConfig": {
            "highAvailability": False,
            "mastersInstanceType": "c5.large",
            "mastersVolumeType": "st2",
            "mastersVolumeSize": 64
        },
        "ingressConfig": {
            "ingressRequired": False,
        },
      "dockerRegistryConfig": {
            "dockerRegistryRequired": True,
            "dockerRegistryVolumeType": "st2",
            "dockerRegistryVolumeSize": 32,
      },
      "ebsProviderConfig": {
            "ebsProviderRequired": True,
            "ebsUser": "ebs",
      },
    }
 )
c2-eks K2 Cloud API Client
c2-eks CreateCluster \
    name production \
    version 1.18.2 \
    resourcesVpcConfig.securityGroupIds.0 sg-C46E1CB8  \
    resourcesVpcConfig.subnetIds.0 subnet-F2276B20 \
    remoteAccessConfig.ec2SshKey production
aws-cli
aws eks --endpoint https://eks.k2.cloud/ create-cluster \
    --name test2 \
    --role-arn '' \
    --resources-vpc-config 'subnetIds=subnet-97E15280,securityGroupIds=sg-0BF242A6' \
    --tags=tagkey=tagvalue \
    --kubernetes-version 1.18.2 \
    --kubernetes-network-config 'serviceIpv4Cidr=10.96.0.0/16,ipFamily=ipv4'