---
id: "k8s-service"
type: "component"
kind: "load-balancer"
provider: "k8s"
category: "edge"
aliases: "svc"
docs: "https://kubernetes.io/docs/concepts/services-networking/service/"
url: "https://localhost:3000/catalogue/components/k8s-service"
---

# Service

Stable virtual address load balancing layer 4 traffic across the ready Pods a selector matches.

| | |
|---|---|
| Provider | [k8s](https://localhost:3000/catalogue?provider=k8s) |
| Kind | [Load balancer](https://localhost:3000/catalogue/kinds/load-balancer) |
| Category | Edge |
| Official docs | [https://kubernetes.io/docs/concepts/services-networking/service/](https://kubernetes.io/docs/concepts/services-networking/service/) |
| Also known as | svc |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `connectionPreserving` (advanced) | boolean | — | no | false | inherited |
| `global` | boolean | — | no | false | **false** |
| `hashing` | enum | `round-robin`, `least-connections`, `ecmp`, `maglev`, `consistent`, `random` | no | "round-robin" | **"random"** |
| `headless` | boolean | — | no | false | inherited |
| `healthChecks` | boolean | — | no | true | inherited |
| `instances` | integer | — | no | — | inherited |
| `internalTrafficPolicy` | enum | `cluster`, `local` | no | "cluster" | inherited |
| `ipFamilyPolicy` | enum | `single-stack`, `prefer-dual-stack`, `require-dual-stack` | no | "single-stack" | inherited |
| `layer` | enum | `l4`, `l7` | no | "l7" | **"l4"** |
| `managed` | boolean | — | no | false | **false** |
| `serviceType` | enum | `cluster-ip`, `node-port`, `load-balancer`, `external-name` | no | "cluster-ip" | inherited |
| `sessionAffinity` | enum | `none`, `client-ip` | no | "none" | inherited |

Bold values are the ones this component pins.

## Rules that apply · 0

No rule selects this kind or its category.

## Other products of the same kind · 34

- [Server Load Balancer](https://localhost:3000/catalogue/components/alibaba-slb.md) `alibaba-slb` — alibabacloud
- [AWS Application Load Balancer](https://localhost:3000/catalogue/components/alb.md) `alb` — aws
- [AWS Classic Load Balancer](https://localhost:3000/catalogue/components/aws-classic-load-balancer.md) `aws-classic-load-balancer` — aws
- [AWS Global Accelerator](https://localhost:3000/catalogue/components/aws-global-accelerator.md) `aws-global-accelerator` — aws
- [AWS Gateway Load Balancer](https://localhost:3000/catalogue/components/aws-gwlb.md) `aws-gwlb` — aws
- [AWS Network Load Balancer](https://localhost:3000/catalogue/components/nlb.md) `nlb` — aws
- [Azure Application Gateway](https://localhost:3000/catalogue/components/azure-application-gateway.md) `azure-application-gateway` — azure
- [Application Gateway for Containers](https://localhost:3000/catalogue/components/azure-application-gateway-for-containers.md) `azure-application-gateway-for-containers` — azure
- [Azure Load Balancer](https://localhost:3000/catalogue/components/azure-load-balancer.md) `azure-load-balancer` — azure
- [Cloudflare Load Balancing](https://localhost:3000/catalogue/components/cloudflare-load-balancing.md) `cloudflare-load-balancing` — cloudflare
- [Cloudflare Spectrum](https://localhost:3000/catalogue/components/cloudflare-spectrum.md) `cloudflare-spectrum` — cloudflare
- [Apache HTTP Server](https://localhost:3000/catalogue/components/apache-httpd.md) `apache-httpd` — default
- [BFE](https://localhost:3000/catalogue/components/bfe.md) `bfe` — default
- [Caddy](https://localhost:3000/catalogue/components/caddy.md) `caddy` — default
- [Contour](https://localhost:3000/catalogue/components/contour.md) `contour` — default
- [Envoy](https://localhost:3000/catalogue/components/envoy.md) `envoy` — default
- [F5 BIG-IP](https://localhost:3000/catalogue/components/f5-big-ip.md) `f5-big-ip` — default
- [HAProxy](https://localhost:3000/catalogue/components/haproxy.md) `haproxy` — default
- [Keepalived](https://localhost:3000/catalogue/components/keepalived.md) `keepalived` — default
- [Generic load balancer](https://localhost:3000/catalogue/components/load-balancer.md) `load-balancer` — default
- [Load balancer](https://localhost:3000/catalogue/components/load-balancer-tier.md) `load-balancer-tier` — default
- [loxilb](https://localhost:3000/catalogue/components/loxilb.md) `loxilb` — default
- [MetalLB](https://localhost:3000/catalogue/components/metallb.md) `metallb` — default
- [NGINX](https://localhost:3000/catalogue/components/nginx.md) `nginx` — default
- [Traefik](https://localhost:3000/catalogue/components/traefik.md) `traefik` — default
- [DigitalOcean Load Balancers](https://localhost:3000/catalogue/components/digitalocean-load-balancer.md) `digitalocean-load-balancer` — digitalocean
- [Google Cloud Load Balancing](https://localhost:3000/catalogue/components/google-cloud-load-balancing.md) `google-cloud-load-balancing` — gcp
- [IBM Cloud Load Balancer for VPC](https://localhost:3000/catalogue/components/ibm-load-balancer.md) `ibm-load-balancer` — ibm
- [Kubernetes Gateway](https://localhost:3000/catalogue/components/k8s-gateway.md) `k8s-gateway` — k8s
- [Ingress](https://localhost:3000/catalogue/components/k8s-ingress.md) `k8s-ingress` — k8s
- [OCI Load Balancer](https://localhost:3000/catalogue/components/oci-load-balancer.md) `oci-load-balancer` — oci
- [Network Load Balancer](https://localhost:3000/catalogue/components/oci-network-load-balancer.md) `oci-network-load-balancer` — oci
- [OpenStack Octavia](https://localhost:3000/catalogue/components/openstack-octavia.md) `openstack-octavia` — openstack
- [Load Balancer Unit (LBU)](https://localhost:3000/catalogue/components/outscale-lbu.md) `outscale-lbu` — outscale

## Use it in a design

```yaml
nodes:
  - { id: "k8s-service", component: "k8s-service" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# Kubernetes Service: a stable virtual address in front of the Pods a label selector matches,
# load balanced at OSI layer 3-4. Per "Service" the type defaults to ClusterIP (reachable only
# inside the cluster), sessionAffinity defaults to None, internalTrafficPolicy to Cluster and
# ipFamilyPolicy to SingleStack; kube-proxy in iptables mode picks a backend at random, and
# traffic goes only to endpoints whose readiness condition is true.
schemaVersion: "1"
type: "component"
id: "k8s-service"
kind: "load-balancer"
provider: "k8s"
docs: "https://kubernetes.io/docs/concepts/services-networking/service/"
aliases: ["svc"]
defaults:
  managed: false
  layer: "l4"
  hashing: "random"
  global: false
properties:
  serviceType:
    type: "enum"
    values: ["cluster-ip", "node-port", "load-balancer", "external-name"]
    default: "cluster-ip"
  sessionAffinity:
    type: "enum"
    values: ["none", "client-ip"]
    default: "none"
  internalTrafficPolicy:
    type: "enum"
    values: ["cluster", "local"]
    default: "cluster"
  ipFamilyPolicy:
    type: "enum"
    values: ["single-stack", "prefer-dual-stack", "require-dual-stack"]
    default: "single-stack"
  headless:
    type: "boolean"
    default: false
```

Human page: https://localhost:3000/catalogue/components/k8s-service
