Kubernetes defines a Service resource with type
that you can use to create a managed load balancer in SysEleven Stack.
The following Service will expose ports
443 of all Pods in the
default namespace matching the
app: nginx label to the internet through a load balancer:
kind: Service apiVersion: v1 metadata: name: nginx-ingress spec: selector: app: nginx ports: - protocol: TCP port: 80 name: http - protocol: TCP port: 443 name: https type: LoadBalancer
The created LoadBalancer Service might look like this:
$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-ingress LoadBalancer 10.10.10.202 188.8.131.52 80:31228/TCP,443:30279/TCP 11s
The load balancer listens on port
443 and forwards traffic to ports
30279 on the nodes respectively.
Traffic coming into these "NodePorts" is then sent to the Pods matching the Service.