kubernetes
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, gm-control
can utilize some of these APIs to also do easy service announcement and discovery.
Pod Label and Named Port
To discover services, two important bits of information must be configured on each deployed pod; the cluster label and the port name. Without these two, pods will be ignored by the control plane.
Cluster Label
The cluster label is a small piece of metadata attached to the pod to determine what specific service is running in this pod. All pods of the same service will be grouped together and load balanced in the mesh. The default metadata key that will be used is gm_cluster=<service_name>
, but this is user configurable.
NOTE The default label can be changed by the CLI flag
--cluster-label
or environment variableGM_CONTROL_KUBERNETES_CLUSTER_LABEL
when runninggm-control
Port Name
The port name determines which named port to expose in the mesh. Since it's possible for many ports to be open for different purposes, just one must be designated for routing normal traffic. This defaults to the port named http
, but is user configurable.
NOTE The default named port can be changed by the CLI flag
--port-name
or environment variableGM_CONTROL_KUBERNETES_PORT_NAME
when runninggm-control
Example Deployment
The Kubernetes Deployment below is properly setup (label and port) to be discovered by the gm-control
server.
Service Accounts
To discover services from the internal Kubernetes APIs, the pod running the Control server must have additional permissions granted by an admin. To grant this access, have a cluster admin apply one of the following resources (replacing the greymatter
namespace with the namespace of the running control
server), and then add the service account to the pod running gm-control
Single Namespace
This is used when gm-control
is only discovering services in the same namespace it's running in.
Multiple Namespaces
This is used when gm-control
will be discovering services from multiple namespaces across the cluster.
Last updated
Was this helpful?