Create cluster | Cloud Providers | Northflank API docs
v1
Double column
API
CLI
JS Client

Cloud Providers /

Create cluster

Creates a new cluster.

Required permission

Account > Cloud > Clusters > Create

Request body

  • {object}
    • name

      string required

      The name of the cluster.

      min length
      3
      max length
      20
      pattern
      ^[a-zA-Z]((-|\s)?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
    • description

      string

      The description of the cluster.

      max length
      200
      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
    • provider

      string required

      Cloud provider to be used for the selected resource

      one of
      aws, azure, civo, gcp, byok
    • region

      string required

      Region of the cluster.

    • kubernetesVersion

      string required

      Kubernetes version of the cluster.

    • integrationId

      string

      Existing integration to use for this cluster.

      min length
      3
      max length
      20
      pattern
      ^[a-z]-?[a-z0-9]+(-[a-z0-9]+)*$
    • integration

      {object}

      Cloud provider credential input, required fields dependent on which provider is chosen.

      • keyfileJson

        string

        Contents of a GCP key file.

      • accessKey

        string

        AWS access key.

      • secretKey

        string

        AWS secret key.

      • apiKey

        string

        DO API key.

    • nodePools

      [array] required

      An array of node pools.

      • {object}
        • nodeType

          string required

          Machine type to be used by the node pool.

        • nodeCount

          integer required

          Number of nodes to the node pool should be provisioned with.

          min
          0
          max
          250
        • autoscaling

          {object}

          Auto scaling settings to use for the node pool. Requires that the cloud provider supports this feature.

          • enabled

            boolean
          • min

            integer
            min
            0
            max
            249
          • max

            integer
            min
            1
            max
            250
        • computeResources

          {object}
          • gpu

            {object}
            • mig

              {object}
              • enabled

                boolean
              • partitions

                [array]
                • string
            • timeslicing

              {object}
              • enabled

                boolean
              • numSlices

                number
                min
                1
        • preemptible

          boolean

          Configures node pool with preemptible / spot instances if enabled.

        • diskType

          string

          The disk type to use.

        • diskSize

          integer required

          Disk size in GB

          min
          1
        • systemPool

          boolean

          When 'provider' is 'azure', at least one system node pool is required per cluster.

        • availabilityZones

          [array] required

          Zones in which the node pool should be provisioned.

          • string
        • labels

          {object}

          Set of label keys and values that can be used to determine scheduling via resource tags.

      • settings

        {object}
        • builds

          {object}
          • mode

            string
            one of
            paas, internal, build-cluster
          • plan

            string

            Plan to use for builds if they are run on the cluster

            min length
            3
            max length
            39
            pattern
            ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
          • clusterId

            string

            Cluster to use for scheduling builds

            min length
            3
            max length
            39
            pattern
            ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
        • registry

          {object}
          • mode

            string
            one of
            paas, self-hosted
          • registryId

            string

            Credentials to use for storing of images.

            min length
            3
            max length
            39
            pattern
            ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
        • logging

          {object}
          • mode

            string
            one of
            paas, loki
          • loki

            {object}

            Required data for loki setting.

            • s3BucketName

              string required
            • s3AccessKey

              string required
            • s3SecretKey

              string required
            • s3Region

              string required
      • gcp

        {object}

        GCP specific data. Required when provider is gcp.

        • projectId

          string required

          ID of the GCP project the cluster will be provisioned in.

      • aws

        {object}

        AWS specific data. Required when provider is aws.

        • subnets

          string required

          List of subnets the cluster should be created for. At least 2 must be specified.

          min length
          2

    Response body

    • {object}

      Response object.

      • data

        {object} required

        Result data.

        • id

          string required

          Identifier for the cluster.

        • name

          string required

          The name of the cluster.

        • description

          string

          A short description of the cluster.

        • provider

          string

          The cloud provider to which this cluster belongs to.

        • integrationId

          string required

          ID of the provider integration used by this cluster.

          min length
          3
          max length
          39
          pattern
          ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
        • nodePools

          [array] required
          • {object}
            • nodeType

              string required

              Machine type to be used by the node pool.

            • nodeCount

              integer required

              Number of nodes to the node pool should be provisioned with.

              min
              0
              max
              250
            • autoscaling

              {object}

              Auto scaling settings to use for the node pool. Requires that the cloud provider supports this feature.

              • enabled

                boolean
              • min

                integer
                min
                0
                max
                249
              • max

                integer
                min
                1
                max
                250
            • computeResources

              {object}
              • gpu

                {object}
                • mig

                  {object}
                  • enabled

                    boolean
                  • partitions

                    [array]
                    • string
                • timeslicing

                  {object}
                  • enabled

                    boolean
                  • numSlices

                    number
                    min
                    1
            • preemptible

              boolean

              Configures node pool with preemptible / spot instances if enabled.

            • diskType

              string

              The disk type to use.

            • diskSize

              integer required

              Disk size in GB

              min
              1
            • systemPool

              boolean

              When 'provider' is 'azure', at least one system node pool is required per cluster.

            • availabilityZones

              [array] required

              Zones in which the node pool should be provisioned.

              • string
            • labels

              {object}

              Set of label keys and values that can be used to determine scheduling via resource tags.

              • id

                string

                ID of existing node pool. Must be passed when modifying existing node pools. Not relevant for new node pools

          • status

            {object}
            • state

              {object}
              • state

                string
              • transitionTime

                string
            • nextUpdateAfter

              string
          • createdAt

            string required

            The time the cluster was created.

          • deletionRequested

            boolean required

            Indicates if provider resource deletion has been requested by the user.

      API
      CLI
      JS Client

      POST /v1/cloud-providers/clusters

      Example request

      Request body
      curl
      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"GCP Cluster 1","description":"This is a new cluster.","provider":"gcp","region":"europe-west2","kubernetesVersion":"1.23.8","integrationId":"gcp-integration","nodePools":[{"nodeType":"n2-standard-8","nodeCount":3,"autoscaling":{"enabled":true,"min":0,"max":10},"computeResources":{"gpu":{"mig":{"partitions":[null]}}},"preemptible":false,"diskSize":100,"availabilityZones":[null]}],"settings":{"builds":{"plan":"nf-compute-200"},"registry":{"registryId":"my-registry-credentials"}},"gcp":{"projectId":"example-project-id"}}' \
        https://api.northflank.com/v1/cloud-providers/clusters

      Example response

      200 OK

      Details about the created cluster.

      JSON

      {
        "data": {
          "id": "gcp-cluster-1",
          "name": "GCP Cluster 1",
          "description": "The cluster description",
          "provider": "gcp",
          "integrationId": "gcp-integration",
          "nodePools": [
            {
              "nodeType": "n2-standard-8",
              "nodeCount": 3,
              "autoscaling": {
                "enabled": true,
                "min": 0,
                "max": 10
              },
              "computeResources": {
                "gpu": {
                  "mig": {
                    "partitions": [
                      null
                    ]
                  }
                }
              },
              "preemptible": false,
              "diskSize": 100,
              "availabilityZones": [
                null
              ],
              "id": "6aa96121-0345-43ad-bade-af36d540c222"
            }
          ],
          "createdAt": "2021-01-20T11:19:53.175Z",
          "deletionRequested": false
        }
      }

      © 2024 Northflank Ltd. All rights reserved.