Load Balancing and Reverse Proxying for Kubernetes Services

Different load balancing and reverse proxying strategies to use in Production K8s Deployments to expose services to outside traffic

Morning sunlight on Horton Plains National Park

Let’s define some terms!

apiVersion: v1
kind: Service
metadata:
name: myservice
...
spec:
type: <type>
...
ports:
- name: myserviceport1
port: 8080
targetPort: 8080
protocol: TCP
...

The Problem

Pods are ephemeral.

The Solution: Service Types

type: ClusterIP

Pros: None that is specific to this type

curl http://myservice:8080/
curl http://$(kubectl get svc myservice --template='{{.spec.clusterIP}}'):8080/

type: NodePort

curl http://10.128.0.13:31644/

type: LoadBalancer

Bare Metal Service Load Balancer Pattern

Ingress

Gathering All Up Together

Cost

Complexity and Customizability

Latency

Operational Transition

developer, #cloud enthusiast, #apacheStratos committer, expect #linux, #containers, #kubernetes, #microservices, and #devops in general