---
layout: docs
page_title: Services overview
description: >-
  Learn about services and service discovery workflows and concepts for virtual machine environments.
---

# Services

This topic provides overview information about services and how to make them discoverable in Consul when your network operates on virtual machines. If service mesh is enabled in your network, refer to the following articles for additional information about connecting services in a mesh:

- [How Service Mesh Works](/consul/docs/architecture/data-plane/connect)
- [How Consul Service Mesh Works on Kubernetes](/consul/docs/k8s/connect)

## Introduction

A _service_ is an entity in your network that performs a specialized operation or set of related operations. In many contexts, a service is software that you want to make available to users or other programs with access to your network. Services can also refer to native Consul functionality, such as _service mesh proxies_ and _gateways_, that enable you to establish connections between different parts of your network.

You can define and register services with Consul, which makes them discoverable to other services in the network. You can also configure health checks for these services to enable automated failover and load balancing. For example, health checks can help load balancers automatically remove unhealthy service instances, or trigger the promotion of a new database primary when the current one fails.

## Workflow

For service discovery, the core Consul workflow for services consists of three stages:

1. **Define services and health checks:** A service definition lets you define various aspects of the service, including how it is discovered by other services in the network. You can define health checks in the service definitions to verify the health of the service. Refer to [Define Services](/consul/docs/register/service/vm/define) and [Define Health Checks](/consul/docs/register/health-check/vm) for additional information.

1. **Register services and health checks:** After defining your services and health checks, you must register them with a Consul agent. Refer to [Register Services and Health Checks](/consul/docs/register/service/vm) for additional information.

1. **Query for services:** After registering your services and health checks, other services in your network can use the DNS to perform static or dynamic lookups to access your service. Refer to [DNS Usage Overview](/consul/docs/discover/dns) for additional information about the different ways to discover services in your datacenters.

## Service mesh use cases

Consul routes service traffic through sidecar proxies if you use Consul service mesh. As a result, you must specify upstream configurations in service definitions. The service mesh experience is different for virtual machine (VM) and Kubernetes environments.

### Virtual machines

You must define upstream services in the service definition. Consul uses the upstream configuration to bind the service with its upstreams. After registering the service, you must start a sidecar proxy on the VM to enable mesh connectivity. Refer to [Deploy sidecar services](/consul/docs/connect/proxy/sidecar) for additional information.

### Kubernetes

If you use Consul on Kubernetes, enable the service mesh injector in your Consul Helm chart to have Consul automatically add a sidecar to each of your pods using the Kubernetes `Service` definition as a reference. You can specify upstream annotations in the `Deployment` definition to bind upstream services to the pods.
Refer to [`connectInject`](/consul/docs/k8s/connect#installation-and-configuration) and [the upstreams annotation documentation](/consul/docs/k8s/annotations-and-labels#consul-hashicorp-com-connect-service-upstreams) for additional information.

### Multiple services

You can define common characteristics for services in your mesh, such as the admin partition, namespace, or upstreams, by creating and applying a `service-defaults` configuration entry. You can also define override configurations for specific upstreams or service instances. To use `service-defaults` configuration entries, you must enable Consul service mesh in your network.

Refer to [Define Service Defaults](/consul/docs/services/usage/define-services#define-service-defaults) for additional information.
