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

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

OverviewChapter 4 ■ Using Multiple ZonesIn this chapter we shall create a multiple-zone AWS CloudFormation on CoreOS. We shall also demonstratevolume-zone affinity for a persistent volume on a multiple-zone cluster with AWS cloud provider. The stepswe’ll take are as follows:Setting the environmentInitializing a CloudFormationConfiguring cluster.yaml for multiple zonesLaunching the CloudFormationConfiguring External DNSRunning a Kubernetes ApplicationUsing Multiple Zones on AWSSetting the EnvironmentYou’ll find the details of creating a Kubernetes cluster on a CoreOS AWS CloudFormation in Chapter 2. Weonly need to start a single EC2 instance to launch the CloudFormation from. Create an EC2 instance usingthe Amazon Linux AMI, which has the AWS CLI installed by default; the AWS CLI is used to initialize andlaunch a CloudFormation. Obtain the Public IP address of the EC2 instance from the EC2 console. SSH log ininto the EC2 instance:ssh -i "docker.pem" ec2-user@184.73.19.214The Amazon Linux AMI command prompt is displayed.Because we will be launching an AWS CloudFormation for a Kubernetes cluster, the CloudFormationstack name must be one that is not already used. If a CloudFormation stack name is already used an errorsimilar to the following (Figure 4-3) is generated.Figure 4-3. Stack already exists errorTo find whether a CloudFormation stack name can be used, click Services ➤ CloudFormation as shownin Figure 4-4.93

Chapter 4 ■ Using Multiple ZonesFigure 4-4. Choosing Services ➤ CloudFormationThe stacks are listed as shown in Figure 4-5. A stack name the same as one that is listed cannot be usedto create a new stack.Figure 4-5. Listing the CloudFormation stacks94

Overview

Chapter 4 ■ Using Multiple Zones

In this chapter we shall create a multiple-zone AWS CloudFormation on CoreOS. We shall also demonstrate

volume-zone affinity for a persistent volume on a multiple-zone cluster with AWS cloud provider. The steps

we’ll take are as follows:

Setting the environment

Initializing a CloudFormation

Configuring cluster.yaml for multiple zones

Launching the CloudFormation

Configuring External DNS

Running a Kubernetes Application

Using Multiple Zones on AWS

Setting the Environment

You’ll find the details of creating a Kubernetes cluster on a CoreOS AWS CloudFormation in Chapter 2. We

only need to start a single EC2 instance to launch the CloudFormation from. Create an EC2 instance using

the Amazon Linux AMI, which has the AWS CLI installed by default; the AWS CLI is used to initialize and

launch a CloudFormation. Obtain the Public IP address of the EC2 instance from the EC2 console. SSH log in

into the EC2 instance:

ssh -i "docker.pem" ec2-user@184.73.19.214

The Amazon Linux AMI command prompt is displayed.

Because we will be launching an AWS CloudFormation for a Kubernetes cluster, the CloudFormation

stack name must be one that is not already used. If a CloudFormation stack name is already used an error

similar to the following (Figure 4-3) is generated.

Figure 4-3. Stack already exists error

To find whether a CloudFormation stack name can be used, click Services ➤ CloudFormation as shown

in Figure 4-4.

93

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

Saved successfully!

Ooh no, something went wrong!