agent-k8s

by Armory

Helm chartv1.1.0-rc.9App 1.1.0-rc.9

An easy way to install armory's agent for kubernetes

About this chart

Helm Chart for kubernetes agent

Built with Helm v3.6.3

The main intention with this project is to provide an easy way of installing armory's Agent for Kubernetes

Features

  • Allows to easily deploy armory's agent for kubernetes with a single command
  • Allows to customize the agent settings passing a custom file

Requirements

  • possibly helm v3.6.3 (haven't tested with anything prior)
  • An existing kubernetes cluster and a namespace in case you don't want to use 'default'
  • A kubeconfig file in case the agent is set to run in 'infrastructure' mode

Usage

  • helm install release-name path-of-the-chart --namespace=your-namespace
  • helm unisntall release-name --namespace=your-namespace

The release name is used across some of the kubernetes resources that get created, you can also add --set imagePullSecrets=something to use docker registry credentials

Quick Installation

Note: you can also replace helm install by helm template in the below commands to get an output of the kubernetes manifests that are rendered e.g: helm template armory-agent ...

Create a namespace where the agent will be installed:

kubectl create namespace dev

Note: if cloudEnabled is set to false there is no need to provide clientId and clientSecret in the following examples. You will, however, need to set clouddriver's grpc host in grpcUrl such as --set grpcUrl= localhost:9090

Agent mode:

From the root of the chart project:

helm install armory-agent . --set mode=agent,clientId=<your-clientId>,clientSecret=<your/secret> --namespace=dev

Infrastructure mode

This mode allows you to configure multiple Kubernetes clusters managed by a single agent installation.

helm install armory-agent armory/agent-k8s \
  --namespace=dev \
  # NOTE: you can also embed your kubeconfig in the values.yaml file for cleaner
  #       definition. See the values.yaml file in this project for an example.
  --set-file accounts[0].kubeconfig=$HOME/develop/config \
  --set mode=infrastructure,\
        clientId=<your-clientId>,\
        clientSecret=<your/secret>

Chart Values

KeyTypeDefaultDescription
modestringagentRequired. The mode the agent will run in. Either agent or infrastructure.
grpcUrlstringagents.cloud.armory.io:443Required. The URL to connect to Armory Cloud.
cloudEnabledbooltrueWhether this agent will talk to Armory Cloud, or an in-cluster Armory Enterprise instance.
clientIdstringnullClient ID surfaced when registering your Armory Cloud instance. Required if cloudEnabled is true.
clientSecretstringnullClient Secret surfaced when registering your Armory Cloud instance. Required if cloudEnabled is true.
accountNamestringnullName of the account this agent is monitoring. Required if mode is set to 'agent'.
accountslistnullConfigure multiple Kubernetes accounts when running in infrastructure mode. Refer to Kubernetes specific options here. Required if mode is set to 'infrastructure'.
envlistnullOptional. Configure additional environment variables for the agent.

Further customization

If you'd like complete control over the agent's configuration we recommend using the armory-k8s-full chart which can be found here.

GitHub Actions

Create Helm Package After Agent Release

This workflow is exposed by GitHub API, and it basically creates and publish the agent-k8s component into a helm package.

It was meant to be use by armory-io/agent-k8s workflow when there is a new release of it, but we always can trigger it by calling the GitHub API.

Calling GitHub API using curl command:

    curl -X POST \
        -H "Accept: application/vnd.github.v3+json" \
        -H "Authorization: token {GIT_HUB_TOKEN}" \
        https://api.github.com/repos/{REPOSITORY_OWNER}/{REPOSITORY_NAME}/dispatches \
        -d '{"event_type":"agentRelease", "client_payload":{"version":"{HELM_VERSION}", "appVersion":"{AGENT_VERSION}"}}'

License

© 2021 Armory Inc. All rights reserved.

Deploy agent-k8s with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has agent-k8s 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartagent-k8s is pinned at v1.1.0-rc.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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