19.06.2021 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16 ■ Developing a Highly Available Website

A typical command to create an EC2 key pair is as follows:

aws ec2 create-key-pair --key-name kubernetes-coreos --query 'KeyMaterial' --output text >

kubernetes-coreos.pem

chmod 400 kubernetes-coreos.pem

The command to create a KMS key is as follows:

aws kms --region=us-east-1 create-key --description="kube-aws assets"

Copy the KeyMetadata.Arn string and use it to initialize a CloudFormation stack. For example, a cluster

called kubernetes-coreos-cluster-1 with the asset directory as kube-coreos-cluster-1 is initialized as follows:

mkdir kube-coreos-cluster-1

cd kube-coreos-cluster-1

kube-aws init --cluster-name=kubernetes-coreos-cluster-1 --external-dns-name=ORAMAGSEARCH.

COM --region=us-east-1 --availability-zone=us-east-1c --key-name=kubernetes-coreos --kmskey-arn="arn:aws:kms:us-east-1:xxxxxxxxxx:key/xxxxxxxxxxxxxxxxxxx"

The commands to render the contents of an assets directory, validate a CloudFormation stack, and

launch a CloudFormation stack are as follows:

kube-aws render

kube-aws validate

kube-aws up

Next, launch into the controller instance for each of the Kubernetes clusters. The Public IP of a

controller may be obtained from the EC2 Console as shown in Figure 16-2.

Figure 16-2. CloudFormation for Kubernetes cluster

358

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

Saved successfully!

Ooh no, something went wrong!