v1 · Namespaced Resource

Service

Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.

Looking for some examples?

There are 3 examples of Service that you can use as a starting point to create your own.

apiVersion: v1
kind: Service
metadata:
  name: my-loadbalancer-service
  namespace: default # Service is a namespaced resource
spec:
  type: LoadBalancer
  selector:
    app: my-app
  ports:
    - port: 80 # port that will be externally exposed on the load balancer
      targetPort: 8080 # pod's port for internal routing
    - port: 443 # port that will be externally exposed on the load balancer
      targetPort: 8443 # pod's port for internal routing

Tired of using Kubectl? 😓

Experience hassle-free Kubernetes management with a powerful GUI.

Screenshot of Aptakube showing a list of pods from 2 clusters in a single view