Mint a Kubernetes access token
import requests
url = "https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token \
--header 'Authorization: Bearer <token>'{
"expires_at": "2023-11-07T05:31:56Z",
"server": "<string>",
"token": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Cluster Access
Mint a Kubernetes access token
Mints a short-lived bearer token for the cluster’s kube gateway (valid for one hour by default), as used by the CLI’s kubectl exec credential plugin. Requires kube_access.use on the cluster, and the minted token carries the calling token’s restrictions; requests are rate limited per user (429).
POST
/
api
/
v1
/
clusters
/
{cluster_id}
/
k8s-token
Mint a Kubernetes access token
import requests
url = "https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/clusters/{cluster_id}/k8s-token \
--header 'Authorization: Bearer <token>'{
"expires_at": "2023-11-07T05:31:56Z",
"server": "<string>",
"token": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.