Grey Matter Fabric supports service discovery from Kubernetes. See the Grey Matter Control Kubernetes discovery setup documentation for how to configure this with Grey Matter Control.
Kubernetes (k8s) has a number of internal APIs that are used for the complex orchestration of containers. When using k8s as the underlying orchestration platform, Grey Matter Control can utilize some of these APIs to also do easy service announcement and discovery.
The Grey Matter Control server will discover services based on their pod IP and container port, see the kubernetes specifications in the setup docs for how to configure your deployments for service discovery. Also, see the example deployment.
As described in the Grey Matter Control service discovery kubernetes docs, the Grey Matter Control server will discover from namespaces specified on startup by the environment variable
GM_CONTROL_KUBERNETES_NAMESPACES. In the case that a Kubernetes namespace that Control is configured to discover from is or becomes undiscoverable (see permissions), the Control server follows a specific pattern of behavior.
If a namespace goes down, the Control server will label the connection to the namespace as having a bad state. It will retain the last known state of discovered pods for the namespace and generate clusters for them. If the namespace eventually becomes discoverable again, it will update its pod list accordingly. In the meantime, it will continue to poll the unavailable namespace, and it will be left up to EDS to determine the endpoint health for the last known state of the pods.
The Kubernetes Deployment below is properly setup (label and port) to be discovered by the Grey Matter Control server.
apiVersion: apps/v1kind: Deploymentspec:selector:matchLabels:app: examplereplicas: 1template:metadata:labels:gm_cluster: examplespec:containers:- name: example-serviceimage: docker.greymatter.io/internal/example-service:latest- name: sidecarimage: docker.greymatter.io/release/gm-proxy:1.2.1imagePullPolicy: Alwaysports:- name: httpcontainerPort: 9080- name: metricscontainerPort: 8081env:- name: PROXY_DYNAMICvalue: "true"- name: XDS_CLUSTERvalue: example- name: XDS_HOSTvalue: gm-control- name: XDS_PORTvalue: "50000"