Introduction

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.

Creating your application manifest YAML file

  • Create a new file called “komiser-with-elb.yml” with the following contents
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
  • Deploy your application by using kubectl
kubectl create -f komiser-with-elb.yml
  • Describe the properties of your newly deployed Service
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
  • The line “LoadBalancer Ingress” identifies the DNS name of the created Classic Load Balancer
LoadBalancer Ingress:     af1946c8b7c9711e9b386025ea934319-1258817048.eu-west-1.elb.amazonaws.com
  • Access the DNS name with your preferred browser and watch the magic happen. Don’t worry if Komiser doesn’t show you any information apart from the standard landing page, we will learn how to fix that further along in the Workshop