In this section, we will deploy a web based application called Komiser and configure an associated Service leveraging the Classic Load Balancer to expose the application externally.
apiVersion: v1
kind: Service
metadata:
name: komiser-with-elb
labels:
name: komiser-with-elb
spec:
selector:
app: komiser-with-elb
ports:
- name: http
protocol: TCP
port: 80
targetPort: 3000
type: LoadBalancer
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: komiser-with-elb
labels:
name: komiser-with-elb
spec:
replicas:
template:
metadata:
labels:
app: komiser-with-elb
spec:
containers:
- name: komiser-with-elb
image: mlabouardy/komiser:2.1.0
imagePullPolicy: Always
ports:
- containerPort: 3000
kubectl create -f komiser-with-elb.yml
kubectl describe services
Locate the newly created Service by looking for a Service named “komiser-with-elb” with similar content to the below
Name: komiser-with-elb
Namespace: default
Labels: name=komiser-with-elb
Annotations: <none>
Selector: app=komiser-with-elb
Type: LoadBalancer
IP: 10.100.95.194
LoadBalancer Ingress: af1946c8b7c9711e9b386025ea934319-1258817048.eu-west-1.elb.amazonaws.com
Port: http 80/TCP
TargetPort: 3000/TCP
NodePort: http 30142/TCP
Endpoints: 192.168.2.13:3000
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 15m service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 15m service-controller Ensured load balancer
LoadBalancer Ingress: af1946c8b7c9711e9b386025ea934319-1258817048.eu-west-1.elb.amazonaws.com