How To: Estimate the Cost of a Kubernetes Cluster Before Provisioning
  • 17 Sep 2024
  • 5 Minutes to read
  • Contributors
  • Dark
    Light

How To: Estimate the Cost of a Kubernetes Cluster Before Provisioning

  • Dark
    Light

Article summary

The RealTheory Cost Calculator service helps you turn anticipated usage into an estimated cost, which makes it easier to plan and budget for your Kubernetes cluster.

Get Cost Estimate

To get a cost estimate for a Kubernetes cluster before provisioning it, call the method below on the K8sCostCalculator endpoint.

POST <endpoint>/theory/api/v1/k8scostcalculator/clustercosts?provider={provider}&rateCard={rateCard}&unitOfMeasure={unitOfMeasure}&currencyCode={currencyCode}

where:

  • {endpoint} - is the URL of the RealTheory SaaS portal for your account.
  • {provider} - is the cloud provider associated with the estimate. Supported values are 'AWS', 'GCP' and 'Azure'.
  • {rateCard} - is the rate card associated with the cluster blueprint. Default is 'On-Demand'.
  • {unitOfMeasure} - is the unit of time associated with the estimate. Supported values are 'Hourly', 'Daily', 'Monthly' and 'Yearly'. Default is 'Monthly'.
  • {currencyCode} - is the currency code associated with the estimate. Default is 'USD'

Request Body:

An example request body posted with the API call has the following structure:

{
  "offering": {
    "region": "us-east-1"
  },
  "loadBalancer": {
    "enabled": true,
    "region": "us-east-1"
  },
  "nodePools": [
    {
      "os": "linux",
      "instanceType": "m5.2xlarge",
      "nodeCount": 5,
       "region": "us-east-1",
    }
  ],
  "nodes": [
    {
      "os": "linux",
      "instanceType": "c5.xlarge",
      "region": "us-east-1",
    },
    {
      "os": "linux",
      "instanceType": "c5.xlarge",
      "region": "us-east-1",
    }
  ],
  "pvs": [
    {
      "sku": "gp2",
      "capacity": "64Gi",
      "region": "us-east-1"
    },
    {
      "sku": "gp3",
      "capacity": "256Gi",
      "region": "us-east-1"
    }
  ],
  "network": [
    {
      "sku": "zone",
      "received": "8192",
      "transmitted": "4096",
      "region": "us-east-1"
    },
    {
      "sku": "region",
      "received": "8192",
      "transmitted": "4096",
      "region": "us-east-1"
    },
    {
      "sku": "internet",
      "received": "2048",
      "transmitted": "1024",
      "region": "us-east-1"
    }
  ]
}

where:

  • offering
    • sku - is the managed Kubernetes service SKU. This parameter is optional and if not specified will default to standard SKU for the selected cloud provider.
      • AWS examples include: 'Amazon EKS', 'Amazon EKS - AWS Outposts'
      • GCP examples include: 'Standard', 'Enterprise'
      • Azure examples include: 'Standard'
    • region - is the region containing the managed Kubernetes service.
      • AWS examples include: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples include: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples include: 'eastus', 'westeurope', 'southeastasia'
  • loadBalancer
    • enabled- is a flag that defines if the Kubernetes cluster includes a load balancer. This parameter is optional and if not specified will default to true.
    • sku - is the managed load balancer SKU. This parameter is optional and if not specified will default to standard SKU for the selected cloud provider.
      • AWS examples include: 'Load Balancer-Application', 'Load Balancer-Network'
      • GCP examples include: 'Regional Internal', 'Regional External', 'Global External'
      • Azure examples include: 'Standard', 'Gateway'
    • region - is the region containing the managed load balancer.
      • AWS examples include: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples include: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples include: 'eastus', 'westeurope', 'southeastasia'
  • nodePools
    • os - is the operating system. Supported values include 'linux' and 'windows'.
    • instanceType - is any valid instance types for the specified cloud provider.
      • AWS examples include: 't3.small', 'm5.large', 'c5.2xlarge'
      • GCP examples include: 't2a-standard-2', 'n2-standard-4', 'c2-standard-8'
      • Azure examples include: 'Standard_B4ms', 'Standard_DS2_v2', 'Standard_D8s_v3'
    • nodeCount - is the number of nodes within the node pool.
    • region - is the region containing the node pool.
      • AWS examples: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples: 'eastus', 'westeurope', 'southeastasia'
  • nodes
    • os - is the operating system. Supported values include 'linux' and 'windows'.
    • instanceType - is any valid instance types for the specified cloud provider.
      • AWS examples include: 't3.small', 'm5.large', 'c5.2xlarge'
      • GCP examples include: 't2a-standard-2', 'n2-standard-4', 'c2-standard-8'
      • Azure examples include: 'Standard_B4ms', 'Standard_DS2_v2', 'Standard_D8s_v3'
    • region - is the region containing the node.
      • AWS examples include: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples include: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples include: 'eastus', 'westeurope', 'southeastasia'
  • pvs
    • capacity - is the size of the persistent volume. Supported units include Ki, Mi, Gi, Ti, K, M, G, T.
    • sku - is the persistent volume SKU.
      • AWS examples include: 'Standard', 'GP2', 'GP3', 'IO1', 'SC1', 'ST1', 'Standard'
      • GCP examples include: 'pd-standard', 'pd-ssd', 'pd-balanced', 'pd-extreme', 'pd-standard-regional', 'pd-ssd-regional', 'pd-balanced-regional'
      • Azure examples include: 'Standard_LRS', 'StandardSSD_LRS', 'StandardSSD_ZRS', 'PremiumSSD_LRS', 'PremiumSSD_ZRS'
    • region - is the region containing the persisted volume.
      • AWS examples include: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples include: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples include: 'eastus', 'westeurope', 'southeastasia'
  • network
    • sku - is the network bandwidth SKU. Supported values include 'zone', 'region' and 'internet'.
    • received - is the amount of data received per hour in KiB for the SKU.
    • transmitted - is the amount of data transmitted per hour in KiB for the SKU.
    • region - is the region associated with the network traffic.
      • AWS examples include: 'us-east-1', 'eu-west-1', 'ap-east-1'
      • GCP examples include: 'us-east1', 'europe-west1', 'asia-south1'
      • Azure examples include: 'eastus', 'westeurope', 'southeastasia'

Note: All calls to RealTheory APIs must be authenticated and authorized. See Authentication for more details.

Example:

POST myendpoint.realtheory.io/theory/api/v1/k8scostcalculator/clustercosts?provider=AWS&rateCard=On-Demand&unitOfMeasure=Monthly&currencyCode=USD

with the request body below:

{
  "offering": {
    "region": "us-east-1"
  },
  "loadBalancer": {
    "enabled": true,
    "region": "us-east-1"
  },
  "nodePools": [
    {
      "os": "linux",
      "region": "us-east-1",
      "instanceType": "m5.2xlarge",
      "nodeCount": 5
    }
  ],
  "nodes": [
    {
      "os": "linux",
      "region": "us-east-1",
      "instanceType": "c5.xlarge"
    },
    {
      "os": "linux",
      "region": "us-east-1",
      "instanceType": "c5.xlarge"
    }
  ],
  "pvs": [
    {
      "sku": "gp2",
      "capacity": "64Gi",
      "region": "us-east-1"
    },
    {
      "sku": "gp3",
      "capacity": "256Gi",
      "region": "us-east-1"
    }
  ],
  "network": [
    {
      "sku": "zone",
      "received": "8192",
      "transmitted": "4096",
      "region": "us-east-1"
    },
    {
      "sku": "region",
      "received": "8192",
      "transmitted": "4096",
      "region": "us-east-1"
    },
    {
      "sku": "internet",
      "received": "4096",
      "transmitted": "2048",
      "region": "us-east-1"
    }
  ]
}

which returns a cost estimate, which looks like:

{
    "kubernetes": 72.00,
    "loadBalancer": 16.200,
    "nodes": 1627.20,
    "storage": 26.51213,
    "network": 1.712813,
    "overhead": 0.00,
    "total": 1743.62495,
    "unitOfMeasure": "Monthly",
    "currencyCode": "USD"
}

where:

  • kubernetes - is the cost of the Kubernetes managed services over the specified time period in the specified currency.
  • loadBalancer - is the cost of the load balancer over the specified time period in the specified currency.
  • nodes - is the total cost of the nodes over the specified time period in the specified currency.
  • storage - is the total cost of storage over the specified time period in the specified currency.
  • network - is the total cost of the network bandwidth over the specified time period in the specified currency.
  • total - is the total cost of the Kubernetes cluster over the specified time period in the specified currency.
  • unitOfMeasure - is the unit of time associated with the cost estimate.
  • currencyCode - is the currency code associated with the cost estimate.

Was this article helpful?