Skip to content

Enrich with Kubernetes

For ovn-kubernetes deployments, the Kubernetes enrichment provider resolves OVN entities to Kubernetes resources — namespaces, pods and nodes — using a kubeconfig.

Like all enrichment, it is optional and additive.

Configure with flags

Enable it for the default cluster with --kube-enrichment. The standard KUBECONFIG environment variable is read as the default kubeconfig path:

bash
./bin/northwatch \
  --ovn-nb-addr tcp:10.0.0.1:6641 \
  --ovn-sb-addr tcp:10.0.0.1:6642 \
  --kube-enrichment \
  --kubeconfig /home/me/.kube/config \
  --kube-context my-cluster
FlagEnv varDefault
--kube-enrichmentNORTHWATCH_KUBE_ENRICHMENTfalse
--kubeconfigKUBECONFIG(none)
--kube-contextNORTHWATCH_KUBE_CONTEXT(none)

If --kubeconfig is empty, the usual in-cluster / default-kubeconfig resolution applies.

Configure per cluster

In a multi-cluster config file, use a kubernetes enrichment block:

json
{
  "name": "ovn-k8s",
  "ovn_nb_addr": "tcp:10.0.0.1:6641",
  "ovn_sb_addr": "tcp:10.0.0.1:6642",
  "enrichment": {
    "type": "kubernetes",
    "kubeconfig": "/home/me/.kube/config",
    "kube_context": "my-cluster"
  }
}

What gets resolved

Enrichment keys off the k8s.ovn.org/* external_ids ovn-kubernetes writes onto the NB objects. The pod reference also drives an API lookup for the node and labels:

OVN entityexternal_ids / keyResolved to
Logical_Switch_Portk8s.ovn.org/pod (namespace/name), k8s.ovn.org/nadPod name and namespace; node name and pod labels via an API lookup; the NAD as extra
Logical_Switchk8s.ovn.org/networkNetwork name
Logical_Routerk8s.ovn.org/networkNetwork name
NATNot resolved

Confirm it is on

As with any provider, an active Kubernetes enricher adds the enrich capability:

bash
curl -s http://localhost:8080/api/v1/capabilities

A cluster cannot use both OpenStack and Kubernetes enrichment at the same time — configure exactly one provider per cluster.

For the provider model and caching, see Enrichment.