148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}
Initializing a CloudFormationChapter 4 ■ Using Multiple ZonesInitializing a CloudFormation stack is discussed in detail in Chapter 2. The procedure to create an AWSCloudFormation is as follows:1. Install Kube-aws (required to be installed only once for the Amazon Linuxinstance).2. Set up Cluster Parameters, such as creating an EC2 key pair (kubernetescoreos),KMS key, and External DNS name (oramagsearch.com).3. Create an Asset Directory for a cluster CloudFormation.4. Initialize the cluster CloudFormation.5. Render the Contents of the asset directory.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.pemchmod 400 kubernetes-coreos.pemThe 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 clustercalled kubernetes-coreos-cluster with the asset directory kube-coreos-cluster is initialized as follows:mkdir kube-coreos-clustercd kube-coreos-clusterkube-aws init --cluster-name=kubernetes-coreos-cluster --external-dns-name=ORAMAGSEARCH.COM--region=us-east-1 --availability-zone=us-east-1c --key-name=kubernetes-coreos --kms-keyarn="arn:aws:kms:us-east-1:xxxxxxxxxx:key/xxxxxxxxxxxxxxxxxxx"The command to render the contents of an assets directory is as follows:kube-aws renderConfiguring cluster.yaml for Multiple ZonesBy default a single zone is used to launch a CloudFormation. Next, we shall customize the CloudFormationto configure multiple zones. Open the cluster.yaml file in a vi editor:sudo vi cluster.yamlThe region to provision the CloudFormation is set to us-east-1 as specified in the kube-aws initcommand. The availabilityZone is set to us-east-1c also as specified in the kube-aws init command.For a multi-availability zone or multiple zones, comment out the availabilityZone. By defaultworkerCount, which specifies the number of worker nodes to create, is set to 1. To demonstrate a multiplezonecluster, the worker nodes must be set to at least the number of zones to configure. Set workerCount to 6as shown in Figure 4-6.95
Chapter 4 ■ Using Multiple ZonesFigure 4-6. Setting workerCount to 6Cluster.yaml is configured for a single availability zone by default, and the instanceCIDR settingspecifies the CIDR for the Kubernetes subnet. For multiple availability zones the instanceCIDR must becommented out, as we need to configure multiple subnets in cluster.yaml. In setting subnets, specify theKubernetes subnets and their CIDRs and availability zones. The objective of high availability is that failureof a single zone does not result in interruption in the service. At least two subnets must be specified for highavailability of zones. Each subnet is specified as an availabilityZone setting and an instanceCIDR setting.The availability zones that could be specified must be available to create subnets. If an availability zone is notavailable, an error such as the one shown in Figure 4-7 is generated when the CloudFormation is launched.96
- Page 59 and 60: Chapter 2 ■ Kubernetes on CoreOS
- Page 61 and 62: Chapter 2 ■ Kubernetes on CoreOS
- Page 63 and 64: Chapter 2 ■ Kubernetes on CoreOS
- Page 65 and 66: Chapter 2 ■ Kubernetes on CoreOS
- Page 67 and 68: Chapter 3 ■ Kubernetes on Google
- Page 69 and 70: Chapter 3 ■ Kubernetes on Google
- Page 71 and 72: Chapter 3 ■ Kubernetes on Google
- Page 73 and 74: Chapter 3 ■ Kubernetes on Google
- Page 75 and 76: Chapter 3 ■ Kubernetes on Google
- Page 77 and 78: Chapter 3 ■ Kubernetes on Google
- Page 79 and 80: Chapter 3 ■ Kubernetes on Google
- Page 81 and 82: Chapter 3 ■ Kubernetes on Google
- Page 83 and 84: Chapter 3 ■ Kubernetes on Google
- Page 85 and 86: Chapter 3 ■ Kubernetes on Google
- Page 87 and 88: Chapter 3 ■ Kubernetes on Google
- Page 89 and 90: Chapter 3 ■ Kubernetes on Google
- Page 91 and 92: Chapter 3 ■ Kubernetes on Google
- Page 93 and 94: Chapter 3 ■ Kubernetes on Google
- Page 95 and 96: Chapter 3 ■ Kubernetes on Google
- Page 97 and 98: Chapter 3 ■ Kubernetes on Google
- Page 99 and 100: Chapter 3 ■ Kubernetes on Google
- Page 101 and 102: Chapter 3 ■ Kubernetes on Google
- Page 103 and 104: Chapter 3 ■ Kubernetes on Google
- Page 105 and 106: PART IIAdministration andConfigurat
- Page 107 and 108: Chapter 4 ■ Using Multiple ZonesS
- Page 109: Chapter 4 ■ Using Multiple ZonesF
- Page 113 and 114: Chapter 4 ■ Using Multiple ZonesA
- Page 115 and 116: Chapter 4 ■ Using Multiple ZonesF
- Page 117 and 118: Chapter 4 ■ Using Multiple ZonesR
- Page 119 and 120: Chapter 4 ■ Using Multiple ZonesF
- Page 121 and 122: Chapter 4 ■ Using Multiple ZonesF
- Page 123 and 124: Chapter 4 ■ Using Multiple ZonesL
- Page 125 and 126: Chapter 4 ■ Using Multiple ZonesF
- Page 127 and 128: Chapter 4 ■ Using Multiple ZonesI
- Page 129 and 130: Chapter 4 ■ Using Multiple ZonesC
- Page 131 and 132: Chapter 4 ■ Using Multiple ZonesA
- Page 133 and 134: Chapter 5 ■ Using the Tectonic Co
- Page 135 and 136: Chapter 5 ■ Using the Tectonic Co
- Page 137 and 138: Chapter 5 ■ Using the Tectonic Co
- Page 139 and 140: Chapter 5 ■ Using the Tectonic Co
- Page 141 and 142: Chapter 5 ■ Using the Tectonic Co
- Page 143 and 144: Chapter 5 ■ Using the Tectonic Co
- Page 145 and 146: Chapter 5 ■ Using the Tectonic Co
- Page 147 and 148: Chapter 5 ■ Using the Tectonic Co
- Page 149 and 150: Chapter 5 ■ Using the Tectonic Co
- Page 151 and 152: Chapter 6 ■ Using VolumesPodDocke
- Page 153 and 154: Chapter 6 ■ Using VolumesObtain t
- Page 155 and 156: Chapter 6 ■ Using VolumesFigure 6
- Page 157 and 158: Chapter 6 ■ Using VolumesThe prec
- Page 159 and 160: Chapter 6 ■ Using VolumesFigure 6
Chapter 4 ■ Using Multiple Zones
Figure 4-6. Setting workerCount to 6
Cluster.yaml is configured for a single availability zone by default, and the instanceCIDR setting
specifies the CIDR for the Kubernetes subnet. For multiple availability zones the instanceCIDR must be
commented out, as we need to configure multiple subnets in cluster.yaml. In setting subnets, specify the
Kubernetes subnets and their CIDRs and availability zones. The objective of high availability is that failure
of a single zone does not result in interruption in the service. At least two subnets must be specified for high
availability of zones. Each subnet is specified as an availabilityZone setting and an instanceCIDR setting.
The availability zones that could be specified must be available to create subnets. If an availability zone is not
available, an error such as the one shown in Figure 4-7 is generated when the CloudFormation is launched.
96