148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

marco.cirilli
from marco.cirilli More from this publisher
19.06.2021 Views

Chapter 16 ■ Developing a Highly Available WebsiteFigure 16-8. EC2 instances for three CloudFormations for Kubernetes clustersConfiguring External DNSNext, add an A record for each of the controller instances to the oramagsearch.com (the domain name wouldbe different for different users) domain zone file as shown in Figure 16-9.Figure 16-9. Adding A records for controller instances361

Chapter 16 ■ Developing a Highly Available WebsiteCreating a Kubernetes ServiceIn this section we shall create a hello-world application and expose the application as a service of typeLoadBalancer on each of the three Kubernetes clusters. As a result, three elastic load balancers eachexposing the hello-world service should be available.SSH log in to each of the controller instances and after verifying that the cluster nodes are being listedcreate an application with the tutum/hello-world Docker image.kubectl -s http://localhost:8080 run hello-world --image=tutum/hello-world --replicas=2--port=8List the cluster-wide pods:kubectl get pods –o wideList the deployments:kubectl get deploymentsSubsequently, expose the deployment as a service of type LoadBalancer:kubectl expose deployment hello-world--port=80 --type=LoadBalancerList the services:kubectl get servicesThe output from the preceding commands is shown in Figure 16-10.Figure 16-10. Creating a hello-world deployment and service362

Chapter 16 ■ Developing a Highly Available Website

Figure 16-8. EC2 instances for three CloudFormations for Kubernetes clusters

Configuring External DNS

Next, add an A record for each of the controller instances to the oramagsearch.com (the domain name would

be different for different users) domain zone file as shown in Figure 16-9.

Figure 16-9. Adding A records for controller instances

361

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!