CreateNodegroup#

Description#

Creating a managed node group.

Request Syntax#

 POST /clusters/name/node-groups HTTP/1.1
 Content-type: application/json

 {
    "capacityType": "string",
    "diskSize": number,
    "instanceTypes": [ "string" ],
    "labels": {
       "string" : "string"
    },
    "launchTemplate": {
       "id": "string",
       "name": "string",
       "version": "string"
    },
    "nodegroupName": "string",
    "remoteAccess": {
       "ec2SshKey": "string",
    },
    "scalingConfig": {
       "desiredSize": number,
       "maxSize": number,
       "minSize": number
    },
    "subnets": [ "string" ],
    "tags": {
       "string" : "string"
    },
    "taints": [
       {
          "effect": "string",
          "key": "string",
          "value": "string"
       }
    ],
    "updateConfig": {
       "maxUnavailable": number,
       "maxUnavailablePercentage": number
    }
 }

URI Request Parameters#

The request uses the following URI parameters.

  • name — The name of the cluster where the node group will be created.

    • Required: Yes

Request Parameters#

Required parameters#

  • instanceTypes — The instance type defined by the first passed element.

    • Type: Array of strings

    • Required: Yes

  • nodegroupName — The unique name for a node group you create.

    • Type: String

    • Required: Yes

Optional parameters#

  • capacityType — The way the capacity is provided to the node group.

    • Type: String

    • Valid values: ON_DEMAND

    • Required: No

    • Default value: ON_DEMAND

  • diskSize — The size of the volume in the node group configuration.

    • Type: Integer

    • Required: No

  • labels — The Kubernetes labels to be applied to the group nodes after creation.

    • Type: UpdateLabelsPayload object

    • Key length constraint: Min — 1. Max — 63.

    • Value length constraint: Min — 1. Max — 63.

    • Required: No

  • remoteAccess — The configuration of remote access to nodes in the node group.

  • scalingConfig — Information on scaling settings for Auto Scaling Group after an update.

  • subnets — The subnets specified for the Auto Scaling Group on which the node group is based.

    • Type: Array of strings

    • Required: No

  • tags — Tags assigned to the resource being created.

    • Type: String map

    • Required: No

  • taints — Taints applied to worker nodes in the Kubernetes cluster.

    Attention

    This object contains only those taints that were applied using API.

    • Type: List of Taint objects

    • Required: No

  • updateConfig — The node group update configuration.

  • version — The Kubernetes version of the node group.

    • Type: String

    • Required: No

Response Syntax#

 HTTP/1.1 200
 Content-type: application/json

 {
    "nodegroup": {
       "capacityType": "string",
       "clusterName": "string",
       "createdAt": number,
       "diskSize": number,
       "health": {
          "issues": [
             {
                "code": "string",
                "message": "string",
                "resourceIds": [ "string" ]
             }
          ]
       },
       "instanceTypes": [ "string" ],
       "labels": {
          "string" : "string"
       },
       "launchTemplate": {
          "id": "string",
          "name": "string",
          "version": "string"
       },
       "modifiedAt": number,
       "nodegroupArn": "string",
       "nodegroupName": "string",
       "nodeRole": "string",
       "remoteAccess": {
          "ec2SshKey": "string",
       },
       "resources": {
          "autoScalingGroups": [
             {
                "name": "string"
             }
          ],
       },
       "scalingConfig": {
          "desiredSize": number,
          "maxSize": number,
          "minSize": number
       },
       "status": "string",
       "subnets": [ "string" ],
       "tags": {
          "string" : "string"
       },
       "taints": [
          {
             "effect": "string",
             "key": "string",
             "value": "string"
          }
       ],
       "updateConfig": {
          "maxUnavailable": number,
          "maxUnavailablePercentage": number
       },
       "version": "string"
    }
 }

Response Elements#

If the request is executed successfully, API will return an HTTP response with 200 code. The response contains the following data in JSON format.

  • nodegroup — The full description of the requested node group.

Examples#

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_nodegroup(
    clusterName="production",
    nodegroupName="test",
    subnets=["subnet-9EFF2520"],
    scalingConfig={
        "desiredSize": 2,
        "minSize": 1,
        "maxSize": 5
    },
    instanceTypes=["t1.medium"],
    labels={
        "test-label": "test-label-value"
    },
    taints=[
        {"key": "key1", "value": "value", "effect": "NO_SCHEDULE"},
        {"key": "key", "effect": "NO_EXECUTE"}
    ],
    remoteAccess={
        "ec2SshKey": "production"
    }
)
c2-eks K2 Cloud API Client
c2-eks CreateNodegroup \
    clusterName production \
    nodegroupName test \
    instanceTypes.0 t1.medium \
    subnets.0 subnet-9EFF2520 \
    scalingConfig.minSize 1 \
    scalingConfig.maxSize 3 \
    scalingConfig.desiredSize 2
aws-cli
aws eks create-nodegroup \
  --endpoint https://eks.k2.cloud/
  --cluster-name production \
  --nodegroup-name test \
  --scaling-config minSize=1,maxSize=5,desiredSize=3 \
  --instance-types c5.medium \
  --subnets subnet-12345678 subnet-98765432 \
  --disk-size 20 \
  --tags Key=Name,Value=your-nodegroup-tag