curl --request POST \
--url https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Inventory a cluster and evaluate its posture now
Starts a collection in the background and answers 202 with the cluster,
collecting: true, at once: a large cluster takes longer than a request
stays open. Read GET /kubernetes/clusters or
GET /kubernetes/clusters/{id} until collecting is false: the run has
then ended, and status and status_reason say how (active, degraded
for a partial run, failed). Starting one while another runs answers the
same way and starts nothing.
If the service restarts during the run, the run is lost. Within about 90
seconds collecting goes false with status: failed and a status_reason
saying so, and it can be started again.
A run reads the cluster’s workloads, namespaces, service accounts and RBAC
through its API server, evaluates the pod-security corpus, and writes the
estate graph. last_workload_count says how many workloads it saw, and
GET /kubernetes/clusters/{id}/posture what it concluded.
A partial run behaves exactly as it does for a cloud collection: one that could not read some namespaces records what it saw and resolves nothing. A list longer than 50,000 objects of one kind is not read to the end, and makes the run partial.
A COMPLETE run removes the estate edges it found no longer true: a workload that has gone, an image a workload no longer runs, an image no longer deployed to the cluster. Assets are kept, and so are edges not written by the collector. A partial run removes nothing.
Behind scans:create.
curl --request POST \
--url https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/collect"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Response
The cluster, collecting: true.