guardrails-agent-kubernetes

by Turbot

Helm chartv0.3.0App 0.3.0Apache-2.0Verified publisher

Guardrails Agent for Kubernetes

About this chart

Guardrails Agent for Kubernetes

This Guardrails agent is used to send Kubernetes cluster details to a Turbot Guardrails workspace using osquery.

Please see Guardrails Kubernetes Integration for more information.

Get Repository Info

helm repo add turbot https://helm.turbot.com
helm repo update

See helm repo for command documentation.

Installing the Chart

Generate an osquery enrollment secret in your Guardrails workspace:

{
  osquery(resource: "[FOLDER_RESOURCE_ID]" resourceTypeUri:"tmod:@turbot/kubernetes#/resource/types/cluster") {
    enrollSecret
  }
}

Create a namespace and secret:

ENROLL_SECRET=eyJh...
kubectl create namespace guardrails
kubectl create secret generic guardrails-agent-kubernetes-secret --from-literal enroll-secret=$ENROLL_SECRET --namespace guardrails

Set Guardrails values in guardrails-values.yaml:

HOSTNAME=myworkspace.turbot.com
echo "guardrails:
  hostname: $HOSTNAME" > guardrails-values.yaml

To install the chart with the release name guardrails-agent-kubernetes:

helm install guardrails-agent-kubernetes turbot/guardrails-agent-kubernetes --namespace guardrails -f guardrails-values.yaml

View the logs:

kubectl logs -f sts/guardrails-agent-kubernetes --namespace guardrails

Upgrading the Chart

To upgrade a release to a new chart version:

helm repo update
helm upgrade guardrails-agent-kubernetes turbot/guardrails-agent-kubernetes --namespace guardrails --reuse-values

To update the values, pass in the new values with the -f flag:

helm upgrade guardrails-agent-kubernetes turbot/guardrails-agent-kubernetes --namespace guardrails --reuse-values -f guardrails-values.yaml

Only values included in guardrails-values.yaml will be updated, with priority being given to new values.

Uninstalling the Chart

To uninstall the guardrails-agent-kubernetes deployment:

helm delete guardrails-agent-kubernetes --namespace guardrails

The command removes all the Kubernetes components associated with the chart and deletes the release.

Values

KeyTypeDefaultDescription
affinityobject{}Pod affinity
containerSecurityContextobject{ readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 2000, allowPrivilegeEscalation: false }Security settings for the agent container running in the pod
extraEnvlist[]Extra environment variables to pass to the agent
fullnameOverridestring""Override the full name for resources
guardrails.hostnamestring""Hostname to a Guardrails server
image.pullPolicystringIfNotPresentImage pull policy
image.repositorystringghcr.io/turbot/guardrails-agent-kubernetesImage repository
image.tagstring""Overrides the image tag whose default is the chart appVersion
nameOverridestring""Override the default name for resources
namespaceOverridestring""Override the namespace for deployed resources
nodeSelectorobject{}Node labels for pod assignment
persistence.accessModeslist[ReadWriteOnce]Access modes for the persistent volume
persistence.annotationsobject{}Annotations for the persistent volume
persistence.capacitystring"10Gi"Capacity of the persistent volume
persistence.enabledbooltrueEnable persistence on osquery.db using a PVC. If false, use emptyDir
persistence.selectorobject{}Selector for the persistent volume
persistence.storageClassNamestring``Storage class for the persistent volume
persistence.volumeNamestring""Name of the persistent volume
podAnnotationsobject{}Annotations to be added to pods
podLabelsobject{}Labels to be added to pods
podSecurityContextobject{}Security settings for the the pod
readinessProbe.httpGet.pathstring/HTTP GET path for readiness probe
readinessProbe.httpGet.portstringhttpHTTP GET port for readiness probe
resourcesobject{}CPU/memory resource requests/limits
role.annotationsobject{}Annotations to add to the role
roleBinding.annotationsobject{}Annotations to add to the role binding
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.automountbooltrueWhether to automatically mount the service account's API credentials
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use
statefulSet.annotationsobject{}Annotations to add to the stateful set
tolerationslist[]Tolerations for pod assignment
volumeslist[]Additional volumes for the StatefulSet
volumeMountslist[]Mount paths for the additional volumes

Deploy guardrails-agent-kubernetes with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has guardrails-agent-kubernetes 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 chartguardrails-agent-kubernetes is pinned at v0.3.0 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