kove

by cmacrae

Helm chartv0.2.0App 0.2.0Verified publisher

Watch your in cluster Kubernetes manifests for OPA policy violations and export them as Prometheus metrics

About this chart

Watch your in cluster Kubernetes manifests for OPA policy violations and export them as Prometheus metrics

About

Open Policy Agent provide the fearsome-but-trustworthy gatekeeper, which allows for admission control of Kubernetes manifests being submitted to the API. This is really nice and allows administrators to control the manifests coming in as fine-grained as they please.

However, administrators may not always want to take direct action (such as denial) on manifests arriving at the API. This is where kove comes in.
It allows administrators of Kubernetes clusters to define Rego policies that they want to flag violations for by exposing a Prometheus metric.

Some example use cases include monitoring the use of deprecated APIs, unwanted docker images, or container vars containing strings like API_KEY, etc.
Administrators can craft dashboards or alerts when such conditions are observed to better expose this information to users.

kove is built on an informer model, rather than admission control - so, it works on any existing objects in your cluster, instead of evaluating them when they arrive at the API (upon create/update). This means it'll expose policy violators that may otherwise go unnoticed if they're not updated often.

Values

KeyTypeDefaultDescription
clusterRolestring""ClusterRole to bind the ServiceAccount to use for the Deployment. If none is set, 'view' will be used
configstringsee values.yamlApplication configuration. See the project README for more info
deployment.affinityobject{}Affinity configuration for the Deployment
deployment.annotationsobject{"prometheus.io/path":"/metrics","prometheus.io/port":"3000","prometheus.io/scrape":"true"}Annotations for the Deployment
deployment.livenessProbeobject{"enabled": true, "path": "/healthz", "failureThreshold": 3, "initialDelaySeconds": 0, "periodSeconds": 10, "successThreshold": 1, "timeoutSeconds": 1}Liveness probe configuration for the Deployment
deployment.readinessProbeobject{"enabled": false}Readiness probe configuration for the Deployment
fullnameOverridestring""Overrides the full name for resources created by this chart
image.pullPolicystring"IfNotPresent"Container image pull policy
image.repositorystring"ghcr.io/cmacrae/kove"Container image to use for the deployment
image.tagstring""Container image tag. If empty, defaults to .Chart.AppVersion
imagePullSecretslist[]If authentication is required for pulling the image from the registry, it can be provided here
ingress.annotationsobject{}Annotations for the Ingress
ingress.enabledboolfalseWhether to create an Ingress object
ingress.hostslist[]Host entries for the Ingress
ingress.tlslist[]TLS configuration for the Ingress
nameOverridestring""Overrides the short name for resources created by this chart
namespacestring"default"Namespace to deploy to
nodeSelectorobject{}NodeSelector configuration for the Deployment
policystring""Rego policy to evaluate objects against. See the project README for more info
policyConfigMapstring""Override the ConfigMap containing the Rego policies
prometheusOperatorobjectsee values.yamlConfigures a Prometheus Operator ServiceMonitor object
replicaCountint1Number of replicas for the deployment
resourcesobject{}Configuration for the Deployment resources
service.portint3000Configures the Service port
service.typestring"ClusterIP"Configures the Service type
serviceAccountstring""ServiceAccount to use for the Deployment. If none is set, one will be created
tolerationslist[]Toleration configuration for the Deployment

Metrics

MetricDescription
opa_policy_violationRepresents a Kubernetes object that violates the provided Rego expression. Includes the labels name, namespace, kind, api_version, and ruleset
opa_policy_violations_totalTotal number of policy violations observed
opa_policy_violations_resolved_totalTotal number of policy violation resolutions observed
opa_object_evaluations_totalTotal number object evaluations conducted

Usage

ConfigMap objects containing the Rego policy/policies and the application configuration can be mounted to configure what you want to evaluate and how you want to evaluate it.

Options

OptionDefaultDescription
config""Path to the config file. If not set, this will look for the file config.yaml in the current directory

config

A YAML manifest can be provided in the following format to describe how and what you want to watch for evaluation:

namespace: default
ignoreChildren: true
regoQuery: data.pkgname.blah
policies:
  - example/policies
objects:
  - group: apps
    version: v1
    resource: deployments
  - group: apps
    version: v1
    resource: daemonsets
  - group: apps
    version: v1
    resource: replicasets
OptionDefaultDescription
namespace""Kubernetes namespace to watch objects in. If empty or omitted, all namespaces will be observed
ignoreChildrenfalseBoolean that decides if

Deploy kove with OpenTenant

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