Helm chart for enabling cron pod on the kubernetes cluster to upload cluster data to DevRev cloud.
Currently, collector is supported upto Kubernetes Version 1.24.X
.
If your API server is above that cronjob will not be installed by the helm chart.
-
Install git if not already installed
-
Install Helm if not already installed
The following commands must be executed on the cluster after all prerequisite are installed.
-
Clone this repository
git clone https://github.com/devrev/k8s-info-collector-charts.git
-
Generate Application access token (
AAT
)-
To generate application access token user need to use Personal Access Token(
PAT
) generated through DevRev application.- How to Generate
PAT
?- After logging in to DevRev app click on the organization icon and select
DevOrg Settings
. - Select
Account
tab. - Scroll to the section
Personal Access Token
and generateNew Token
(Please note down the PAT as its visible only one time). - For some reason if you lose PAT create new one with above steps
- After logging in to DevRev app click on the organization icon and select
- How to Generate
-
Use below curl command to generate
AAT
. Make sure you replace<PAT>
in command with the actualPAT
obtained in above step. From response copy theaccess_token
which is yourAAT
.curl --location --request POST 'https://api.devrev.ai/token' \ --header 'Content-Type: application/json' \ --header 'Authorization: <PAT>' \ --data-raw '{ "grant_type" : "urn:devrev:params:oauth:grant-type:token-issue", "requested_token_type" : "urn:devrev:params:oauth:token-type:aat", "expires_in":"365", "token_hint":"kubernetes data for parts discovery" }'
-
-
Set env variable using
AAT
generated in above Stepexport AAT_TOKEN=<AAT GENERATED>
-
Execute below command to upgrade helm chart on your kubernetes cluster.
helm upgrade --install k8s-info-cron-service ./k8s-info-collector-charts/k8s-info-cron-service \ --set secret.applicationToken=$AAT_TOKEN --create-namespace --namespace=k8s-info-cron-service
-
You can view the cronjob on the cluster using the following command
kubectl describe cronjob -n k8s-info-cron-service
-
The collector cron job by default runs once every 6 hours. This frequency can be tuned by adding the cronString parameters to the command while installing the collector. The below example will make the cronjob run every hour.
helm upgrade --install k8s-info-cron-service ./k8s-info-collector-charts/k8s-info-cron-service \ --set secret.applicationToken=$AAT_TOKEN --create-namespace --namespace=k8s-info-cron-service \ --set cronString='0 */1 * * *'
-
Learn more about Parts Discovery here