Kubernetes

Kubernetes service discovery can be used to discover instances using Kuberentes' API.

Agents that run this type of service discovery can operate both outside and within a cluster.

If operating outside of a cluster, ostara.agent.service-discovery.kubernetes.kube-config-path or ostara.agent.service-discovery.kubernetes.kube-config-yaml may be set. If neither are set, it will attempt to find the kube configuration on its own. Additionally, the ostara.agent.service-discovery.namespace must be set.

When operating within a cluster, the agent will use the pod's service account in order to gain access to the cluster, so neither should be set. While a namespace may be set in this approach, if it is not set; the agent will attempt to resolve its own namespace as a last resort. Finally, this type of service discovery becomes active by default when the agent detects it is inside a cluster.

Enabling Discovery

You can enable Kubernetes service discovery in the configuration file by setting ostara.agent.main.kubernetes.enabled to true

When operating inside of Kubernetes, the agent will enable this type of service discovery by default

  • Namespace: The namespace will be taken from the underlaying kub it is running on, if you are running the Agent outside of kub, you must configure the namespace.

  • Actuator path: by default /actuator will be used, if you have set a custom path, configure it here

  • Kub config: The Agent uses the default config if not set, if set kubeConfigYaml takes precedence over kubeConfigPath

  • Port: By default if only 1 port is found it will be used, if multiple ports are found we will seek out the port named in the config.

  • Pod Labels: Here you can set the K/V for the labels on the Pods you want the Agent return from service discovery.

Configuration Table

Last updated