0.6.0 • Published 1 year ago
@elastic/asset-collection v0.6.0
@elastic/asset-collection
This package faciliates collecting asset data for K8s across several cloud providers. Currently, it can do the following:
- Collect from AWS EKS, per AWS region
- Collect from Azure AKS, per Azure subscription ID
- Collect via the K8s API directly, depending on what access your local kubectl config has
Installation and Usage
Option 1: Global npm
$ npm install -g @elastic/asset-collection@latest
$ elastic-assets
Option 2: Local build
Checkout the latest of this repo, then:
$ cd _collector-npm
$ npm install
$ npm run build
$ node ./dist/bin/load.js
Environment variables
Set the following:
# ES credentials for where you want to write ES data
ELASTICSEARCH_HOSTS=http://localhost:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=changeme
# set this to 0 if you are using Elasticsearch with SSL, but with self-signed certs in dev
ELASTICSEARCH_REJECT_UNAUTHORIZED_TLS=0
# defaults to "assets", you probably don't need to set this
ASSETS_DATASTREAM
For AWS K8S collection:
AWS_REGIONS=us-east-1,us-east-2
For Azure K8S collection:
AZURE_SUBSCRIPTION_ID=123abcdefg
Detailed Usage
Run help to see available options:
$ elastic-assets help
Elastic asset collection load script. Please specify the type of load you would like to perform.
help Print this menu
k8s Cycle through all K8s clusters you have access to via your kube config file
and loads k8s assets from those clusters
aws-k8s Connect to AWS EKS and pulls cluster info from the specified region, e.g.
AWS_REGIONS=us-east-1,us-east-2 elastic-assets aws-k8s
azure-k8s Connect to Azure AKS and pulls cluster info from the specified subscription,
e.g. AZURE_SUBSCRIPTION=xyz123 elastic-assets azure-k8s
all Collect all of the above assets (remember to set all necessary env vars)