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 Tanzu Kubernetes Grid Integrated Edition (TKGI) using the TKGI API.
Your Tanzu Kubernetes Grid Integrated Edition 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 TKGI API, you can check the resource and cluster limitations that the administrator has assigned to you as well as review your current usage.
The curl commands in this topic use an access token environment variable to authenticate to the TKGI API endpoints.
To export your access token into an environment variable, run the following command:
tkgi login -a TKGI-API -u USER-ID -p 'PASSWORD' -k; \
export YOUR-ACCESS-TOKEN=$(bosh int ~/.pks/creds.yml --path /access_token)
Where:
TKGI-API
is the FQDN of your TKGI API endpoint. For example, api.tkgi.example.com
.USER-ID
is your Tanzu Kubernetes Grid Integrated Edition user ID.PASSWORD
is your Tanzu Kubernetes Grid Integrated Edition password.YOUR-ACCESS-TOKEN
is the name of your access token environment variable.For example:
$ tkgi login -a tkgi.my.lab -u alana -p 'psswrdabc123...!' -k; \
export access_token=$(bosh int ~/.pks/creds.yml --path /access_token)
Note: If your operator has configured Tanzu Kubernetes Grid Integrated Edition 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 TKGI CLI. For information about configuring SAML, see Connecting Tanzu Kubernetes Grid Integrated Edition to a SAML Identity Provider
The TKGI 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://TKGI-API:9021/v1/quotas/USER-ID
Where:
YOUR-ACCESS-TOKEN
is your access token environment variable.TKGI-API
is the FQDN of your TKGI API endpoint. For example, api.tkgi.example.com
.USER-ID
is your Tanzu Kubernetes Grid Integrated Edition user ID.For example:
$ user=exampleuser
$ tkgi login -a tkgi.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
}
}
The TKGI 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://TKGI-API:9021/v1/usages/USER-ID
Where:
YOUR-ACCESS-TOKEN
is your access token environment variable.TKGI-API
is the FQDN of your TKGI API endpoint. For example, api.tkgi.example.com
.USER-ID
is your Tanzu Kubernetes Grid Integrated Edition user ID.For example:
$ user=exampleuser
$ tkgi login -a tkgi.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
},
}
]
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 TKGI administrator.