Viewing Usage Quotas

Page last updated:

Warning: This feature is a beta component and is intended for evaluation and test purposes only. Do not use this feature in a production environment. Product support and future availability are not guaranteed for beta components.

This topic describes how to review your resource usage and quotas in VMware Enterprise PKS using the Enterprise PKS API.

Overview

Your Enterprise PKS administrator might set a limit on the number of clusters you can provision and
the resources, such as amount of memory and number of CPUs, that are allocated in total to any clusters you create and workloads you deploy.

The resource quota limitations are based on the total allocated size of the VM instances you create, not their actual utilization.

By using the PKS API, you can check the resource and cluster limitations that the administrator has assigned to you as well as review your current usage.

Set up Your API Access Token

The curl commands in this topic use an access token environment variable to authenticate to the PKS API endpoints.

  1. To export your access token into an environment variable, run the following command:

    pks login -a PKS-API -u USER-ID -p 'PASSWORD' -k; \
    export YOUR-ACCESS-TOKEN=$(bosh int ~/.pks/creds.yml --path /access_token)
    

    Where:

    • PKS-API is the FQDN of your PKS API endpoint. For example, api.pks.example.com.
    • USER-ID is your Enterprise PKS user ID.
    • PASSWORD is your Enterprise PKS password.
    • YOUR-ACCESS-TOKEN is the name of your access token environment variable.

    For example:

    $ pks login -a pks.my.lab -u alana -p 'psswrdabc123...!' -k; \
    export my_token=$(bosh int ~/.pks/creds.yml --path /access_token)
    

    Note: If your operator has configured Enterprise PKS to use a SAML identity provider, you must include an additional SSO flag to use the above command. For information about the SSO flags, see the section for the above command in PKS CLI. For information about configuring SAML, see Configure SAML as an Identity Provider in the Installing topic for your IaaS.

View Quotas

The PKS API quotas endpoint returns your resource usage and cluster quota in the JSON format.

To view your resource and cluster quota, run the following command:

curl -k -H "Authorization: Bearer $YOUR-ACCESS-TOKEN" \
https://PKS-API:9021/v1/quotas/USER-ID

Where:

  • YOUR-ACCESS-TOKEN is your access token environment variable.
  • PKS-API is the FQDN of your PKS API endpoint. For example, api.pks.example.com.
  • USER-ID is your Enterprise PKS user ID.

For example:

$ user=exampleuser
$ pks login -a pks.my.lab -u $user -p 'psswrdabc123...!' -k; export TOKEN=$(bosh int ~/.pks/creds.yml --path /access_token)
$ curl -k -H "Authorization: Bearer $TOKEN" \
https://example.com:9021/v1/quotas/$user 
{
  "owner":"cody",
  "limit":{
      "cpu":2,
      "memory":1.0,
      "cluster": 6
  }
}

View Usage

The PKS API usages endpoint reports your actual resource usage in the JSON format.

To view your current allocated resource usage, run the following command:

curl -k -H "Authorization: Bearer $YOUR-ACCESS-TOKEN" \
https://PKS-API:9021/v1/usages/USER-ID

Where:

  • YOUR-ACCESS-TOKEN is your access token environment variable.
  • PKS-API is the FQDN of your PKS API endpoint. For example, api.pks.example.com.
  • USER-ID is your Enterprise PKS user ID.

For example:

$ user=exampleuser
$ pks login -a pks.my.lab -u $user -p 'psswrdabc123...!' -k; export TOKEN=$(bosh int ~/.pks/creds.yml --path /access_token)
$ curl -k -H "Authorization: Bearer $TOKEN" \
https://example.com:9021/v1/usages
[
  {
    "owner": "cody",
    "totals": {
      "cpu": 2,
      "memory": 1,
      "cluster": 2
    },
  }
]

Error Message When You Exceed Cluster Quota

If you exceed your set cluster creation quota, then the following error message appears when you attempt to create a cluster.

Error: You do not have enough privileges to perform this action. 
Please contact the PKS administrator.

Please send any feedback you have to pks-feedback@pivotal.io.