ecs-inventory
by Anchore
A Helm chart for the Anchore ECS Inventory, which gathers an inventory of images in use by Amazon Elastic Container Service (ECS).
About this chart
Anchore ECS Inventory Helm Chart
Note: this integration requires a valid license or subscription entitlement from Anchore
Anchore ECS Inventory: Anchore ECS Inventory
Anchore ECS Inventory is a tool to gather an inventory of images in use by Amazon Elastic Container Service (ECS) and ship them to the Anchore platform. Anchore ECS Inventory must be able to resolve the Anchore URL and requires API credentials. The minimum version of the Anchore Enterprise platform required for K8s Inventory is 4.7.
Installation
Anchore ECS Inventory creates it's own secret based on your values.yaml file for the following keys that are required for successfully deploying and connecting the ecs-inventory service to the Anchore Platform and AWS ECS Service:
- ecsInventory.awsAccessKeyId
- ecsInventory.awsSecretAccessKey
You can install the chart via via:
helm repo add anchore https://charts.anchore.io
helm install <release-name> -f <values.yaml> anchore/ecs-inventory
A basic values file can always be found here. The key configurations are in the ecsInventory section.
Using your own secrets
The (ecsInventory.useExistingSecret and ecsInventory.existingSecretName) or ecsInventory.injectSecretsViaEnv keys allows you to create your own secret and provide it in the values file or place the required secret into the pod via different means such as injecting the secrets into the pod using hashicorp vault.
For example:
-
Create a secret in kubernetes:
apiVersion: v1 kind: Secret metadata: name: ecs-inventory-secrets type: Opaque stringData: ANCHORE_ECS_INVENTORY_ANCHORE_PASSWORD: foobar AWS_ACCESS_KEY_ID: someKeyId AWS_SECRET_ACCESS_KEY: someSecretAccessKey -
Provide it to the helm chart via the values file:
ecsInventory: useExistingSecret: true existingSecretName: "ecs-inventory-secrets"
The Anchore API Password and required AWS secret values can also be injected into the environment of the ecs-inventory container. For injecting the environment variable
# set
ecsInventory:
injectSecretsViaEnv=true
See the ecs-inventory repo for more information about the ECS Inventory specific configuration.
Image Registry
The chart's image is a set of parts rather than one string:
image:
registry: "" # empty -> taken from global.imageRegistryHost
repository: anchore/ecs-inventory
tag: "vX.Y.Z"
The registry is chosen from three levels, most specific first:
| Level | Where | Wins over |
|---|---|---|
1. Per-image registry | image.registry | everything below |
2. global.imageRegistryHost | one value for the whole chart | the chart defaults |
| 3. Chart default | docker.io | — |
Stated as one rule:
An image value that states no registry of its own takes one from
global.imageRegistryHost. An image value that does state one keeps it.
To mirror the image, set the global once:
global:
imageRegistryHost: harbor.example.com
Only the registry comes from the global — the repository and tag stay with the chart, so chart upgrades keep moving the version. global.imageRegistryHost may include a path, eg. harbor.example.com/anchore.
An image value may also be given as a complete reference string (image: myregistry.example.com/anchore/ecs-inventory:vX.Y.Z), which is used as written. A string that states no registry host takes one from the global like any other value.
Parameters
Global Resource Parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistryHost | registry host used by every image value that does not set its own | docker.io |
Common Resource Parameters
| Name | Description | Value |
|---|---|---|
replicaCount | Number of replicas for the Ecs Inventory deployment | 1 |
image.registry | Registry for the ECS Inventory image. Empty means take it from global.imageRegistryHost | "" |
image.repository | Repository for the ECS Inventory image | anchore/ecs-inventory |
image.tag | Tag for the ECS Inventory image | v1.5.3 |
imagePullPolicy | Image pull policy used by all deployments | IfNotPresent |
imagePullSecretName | Name of Docker credentials secret for access to private repos | "" |
serviceAccountName | Name of a service account used to run all Anchore Ecs Inventory pods | "" |
useExistingSecret | set to true to use an existing/precreated secret | false |
existingSecretName | the name of the precreated secret | "" |
injectSecretsViaEnv | Enable secret injection into pod environment variables | false |
extraEnv | extra environment variables. These will be set on all containers. | [] |
annotations | Common annotations set on all Kubernetes resources | {} |
deploymentAnnotations | annotations to set on the ecs-inventory deployment | {} |
containerSecurityContext | The securityContext for all Anchore ECS Inventory containers | {} |
securityContext.runAsUser | The securityContext runAsUser for all Anchore ECS Inventory pods | 1000 |
securityContext.runAsGroup | The securityContext runAsGroup for all Anchore ECS Inventory pods | 1000 |
securityContext.fsGroup | The securityContext fsGroup for all Anchore ECS Inventory pods | 1000 |
resources | Resource requests and limits for Anchore ECS Inventory pods | {} |
nodeSelector | Node labels for pod assignment | {} |
tolerations | Tolerations for pod assignment | [] |
affinity | Affinity for pod assignment | {} |
labels | Adds additionnal labels to all kubernetes resources | {} |
probes.liveness.initialDelaySeconds | Initial delay seconds for liveness probe | 1 |
probes.liveness.timeoutSeconds | Timeout seconds for liveness probe | 10 |
probes.liveness.periodSeconds | Period seconds for liveness probe | 5 |
probes.liveness.failureThreshold | Failure threshold for liveness probe | 6 |
probes.liveness.successThreshold | Success threshold for liveness probe | 1 |
probes.readiness.timeoutSeconds | Timeout seconds for the readiness probe | 10 |
probes.readiness.periodSeconds | Period seconds for the readiness probe | 15 |
probes.readiness.failureThreshold | Failure threshold for the readiness probe | 3 |
probes.readiness.successThreshold | Success threshold for the readiness probe | 1 |
ecsInventory Parameters
| Name | Description | Value |
|---|---|---|
ecsInventory.quiet | Determine whether or not to log the inventory report to stdout | false |
ecsInventory.output | The output format of the report (options: table, json) | json |
ecsInventory.logLevel | the level of verbosity for logs | info |
ecsInventory.logFile | location to write the log file (default is not to have a log file) | "" |
ecsInventory.pollingIntervalSeconds | The polling interval of the ECS API in seconds | 60 |
ecsInventory.anchoreUrl | the url of the anchore platform | http://localhost:8228 |
ecsInventory.anchoreAccount | the account of the anchore platform | admin |
ecsInventory.anchoreUser | the username of the anchore platform | admin |
ecsInventory.anchorePassword | the password of the anchore platform | foobar |
ecsInventory.anchoreHttpInsecure | whether or not anchore is using ssl/tls | true |
ecsInventory.anchoreHttpTimeoutSeconds | the amount of time in seconds before timing out | 10 |
ecsInventory.awsAccessKeyId | the AWS Access Key ID | foobar |
ecsInventory.awsSecretAccessKey | the AWS Secret Access Key | foobar |
ecsInventory.awsRegion | the AWS Region | us-west-2 |
Release Notes
- Major Chart Version Change (e.g., v0.1.2 -> v1.0.0): Signifies an incompatible breaking change that necessitates manual intervention, such as updates to your values file or data migrations.
- Minor Chart Version Change (e.g., v0.1.2 -> v0.2.0): Indicates a significant change to the deployment that does not require manual intervention.
- Patch Chart Version Change (e.g., v0.1.2 -> v0.1.3): Indicates a backwards-compatible bug fix or documentation update.
v0.1.2
- Documentation and test maintenance: regenerated the README parameters table and de-pinned the chart tests from the release version. No deployment changes.
v0.1.0
The image value is now a dict, and the registry can be set once for the whole chart.
- Adds
global.imageRegistryHost. An image value that states no registry of its own takes one from it, so mirroring the Anchore images is a single setting. See Image Registry. imageis nowregistry/repository/tagrather than a reference string. Settingregistrypoints that image at a different registry without pinning its version, so chart upgrades keep moving the tag. A complete reference string is still accepted and is used as written, so existing values files continue to work.- Rendered image references now always include the registry host, so
anchore/ecs-inventory:v1.5.1renders asdocker.io/anchore/ecs-inventory:v1.5.1. This resolves to the same image and is a no-op for pulls, but it changes the pod spec, so an upgrade will show a diff and roll the pods.
No values changes are required to upgrade.
Deploy ecs-inventory with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ecs-inventory on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartecs-inventory is pinned at v0.1.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply