Kubernetes Services

What Is A Kubernetes Service

Service Types

LoadBalancer

apiVersion: v1
kind: Service
metadata:
name: foo-service
namespace: foo-demo
spec:
type: LoadBalancer
selector:
app: foo
environment: demo
ports:
- protocol: TCP
port: 443
targetPort: 8443
status:
loadBalancer:
ingress:
- ip: 10.254.2.127

ClusterIP

apiVersion: v1
kind: Service
metadata:
name: default-grpc
namespace: foo-demo
spec:
type: ClusterIP
selector:
app: foo
environment: demo
clusterIP: 10.0.54.223
ports:
- name: grpc
port: 8443
protocol: TCP
targetPort: 8443

Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: simple-fanout-example
spec:
rules:
- host: foo.bar.com
http:
paths:
- path: /foo
pathType: Prefix
backend:
service:
name: service1
port:
number: 8000
- path: /bar
pathType: Prefix
backend:
service:
name: service2
port:
number: 9000

What is Next

Reference

--

--

A software engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store