Installing a cluster using AWS Local Zones

In OKD version 4.12, you can install a cluster on Amazon Web Services (AWS) into an existing VPC, extending workers to the edge of the Cloud Infrastructure using AWS Local Zones.

AWS Local Zones are a type of infrastructure that place Cloud Resources close to the metropolitan regions. For more information, see the AWS Local Zones Documentation.

OKD can be installed in existing VPCs with Local Zone subnets. The Local Zone subnets can be used to extend the regular workers’ nodes to the edge networks. The edge worker nodes are dedicated to running user workloads.

One way to create the VPC and subnets is to use the provided CloudFormation templates. You can modify the templates to customize your infrastructure or use the information that they contain to create AWS objects according to your company’s policies.

The steps for performing an installer-provisioned infrastructure installation are provided as an example only. Installing a cluster with VPC you provide requires knowledge of the cloud provider and the installation process of OKD. The CloudFormation templates are provided to assist in completing these steps or to help model your own. You are also free to create the required resources through other methods; the templates are just an example.

Prerequisites

Opting into AWS Local Zones

If you plan to create the subnets in AWS Local Zones, you must opt in to each zone group separately.

Prerequisites

  • You have installed the AWS CLI.

  • You have determined into which region you will deploy your OKD cluster.

Procedure

  1. Export a variable to contain the name of the region in which you plan to deploy your OKD cluster by running the following command:

    1. $ export CLUSTER_REGION="<region_name>" (1)
    1For <region_name>, specify a valid AWS region name, such as us-east-1.
  2. Review the list of zones that your region contains by running the following command:

    1. $ aws ec2 describe-availability-zones \
    2. --filters Name=region-name,Values=${CLUSTER_REGION} \
    3. --query 'AvailabilityZones[].ZoneName' \
    4. --all-availability-zones

    Depending on the region, the list of available zones can be long. The different zones use the following naming conventions:

    ${REGION}[a-z]

    Availability zones available in the region.

    ${REGION}-LID-N[a-z]

    Available AWS Local Zones. ${REGION}LID-N is the zone group identifier, and [a-z] is the zone identifier.

    ${REGION}-wl1-LID-wlz-[1-9]

    Available Wavelength zones.

  3. Export a variable to contain the name of the Local Zone to host your VPC by running the following command:

    1. $ export ZONE_GROUP_NAME="${CLUSTER_REGION}-<location_identifier>-<zone_identifier>" (1)
    1For <location_identifier>-<zone_identifier>, specify the location identifier and zone identifier for the Local Zone that you selected for your region. For example, specify nyc-1a to use the US East (New York) Local Zone.
  4. Opt in to the zone group on your AWS account by running the following command:

    1. $ aws ec2 modify-availability-zone-group \
    2. --group-name "${ZONE_GROUP_NAME}" \
    3. --opt-in-status opted-in

Obtaining an AWS Marketplace image

If you are deploying an OKD cluster using an AWS Marketplace image, you must first subscribe through AWS. Subscribing to the offer provides you with the AMI ID that the installation program uses to deploy worker nodes.

Prerequisites

  • You have an AWS account to purchase the offer. This account does not have to be the same account that is used to install the cluster.

Procedure

  1. Complete the OKD subscription from the AWS Marketplace.

  2. Record the AMI ID for your specific region. As part of the installation process, you must update the install-config.yaml file with this value before deploying the cluster.

Sample install-config.yaml file with AWS Marketplace worker nodes

  1. apiVersion: v1
  2. baseDomain: example.com
  3. compute:
  4. - hyperthreading: Enabled
  5. name: worker
  6. platform:
  7. aws:
  8. amiID: ami-06c4d345f7c207239 (1)
  9. type: m5.4xlarge
  10. replicas: 3
  11. metadata:
  12. name: test-cluster
  13. platform:
  14. aws:
  15. region: us-east-2 (2)
  16. sshKey: ssh-ed25519 AAAA...
  17. pullSecret: '{"auths": ...}'
1The AMI ID from your AWS Marketplace subscription.
2Your AMI ID is associated with a specific AWS region. When creating the installation configuration file, ensure that you select the same AWS region that you specified when configuring your subscription.

Creating a VPC that uses AWS Local Zones

You must create a Virtual Private Cloud (VPC), and subnets for each Local Zone location, in Amazon Web Services (AWS) for your OKD cluster to extend worker nodes to the edge locations. You can further customize the VPC to meet your requirements, including VPN, route tables, and add new Local Zone subnets that are not included at initial deployment.

You can use the provided CloudFormation template and a custom parameter file to create a stack of AWS resources that represent the VPC.

If you do not use the provided CloudFormation template to create your AWS infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • You configured an AWS account.

  • You added your AWS keys and region to your local AWS profile by running aws configure.

  • You opted in to the AWS Local Zones on your AWS account.

Procedure

  1. Create a JSON file that contains the parameter values that the template requires:

    1. [
    2. {
    3. "ParameterKey": "ClusterName", (1)
    4. "ParameterValue": "mycluster" (2)
    5. },
    6. {
    7. "ParameterKey": "VpcCidr", (3)
    8. "ParameterValue": "10.0.0.0/16" (4)
    9. },
    10. {
    11. "ParameterKey": "AvailabilityZoneCount", (5)
    12. "ParameterValue": "3" (6)
    13. },
    14. {
    15. "ParameterKey": "SubnetBits", (7)
    16. "ParameterValue": "12" (8)
    17. }
    18. ]
    1A short, representative cluster name to use for hostnames, etc.
    2Specify the cluster name that you used when you generated the install-config.yaml file for the cluster.
    3The CIDR block for the VPC.
    4Specify a CIDR block in the format x.x.x.x/16-24.
    5The number of availability zones to deploy the VPC in.
    6Specify an integer between 1 and 3.
    7The size of each subnet in each availability zone.
    8Specify an integer between 5 and 13, where 5 is /27 and 13 is /19.
  2. Copy the template from the CloudFormation template for the VPC section of this topic and save it as a YAML file on your computer. This template describes the VPC that your cluster requires.

  3. Launch the CloudFormation template to create a stack of AWS resources that represent the VPC by running the following command:

    You must enter the command on a single line.

    1. $ aws cloudformation create-stack --stack-name <name> \ (1)
    2. --template-body file://<template>.yaml \ (2)
    3. --parameters file://<parameters>.json (3)
    1<name> is the name for the CloudFormation stack, such as cluster-vpc. You need the name of this stack if you remove the cluster.
    2<template> is the relative path to and name of the CloudFormation template YAML file that you saved.
    3<parameters> is the relative path to and name of the CloudFormation parameters JSON file.

    Example output

    1. arn:aws:cloudformation:us-east-1:123456789012:stack/cluster-vpc/dbedae40-2fd3-11eb-820e-12a48460849f
  4. Confirm that the template components exist by running the following command:

    1. $ aws cloudformation describe-stacks --stack-name <name>

    After the StackStatus displays CREATE_COMPLETE, the output displays values for the following parameters. You must provide these parameter values to the other CloudFormation templates that you run to create your cluster:

    VpcId

    The ID of your VPC.

    PublicSubnetIds

    The IDs of the new public subnets.

    PrivateSubnetIds

    The IDs of the new private subnets.

    PublicRouteTableId

    The ID of the new public route table ID.

CloudFormation template for the VPC that uses AWS Local Zones

You can use the following CloudFormation template to deploy the VPC that you need for your OKD cluster that uses AWS Local Zones.

CloudFormation template for the VPC

  1. AWSTemplateFormatVersion: 2010-09-09
  2. Description: Template for Best Practice VPC with 1-3 AZs
  3. Parameters:
  4. ClusterName:
  5. Type: String
  6. Description: ClusterName used to prefix resource names
  7. VpcCidr:
  8. AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
  9. ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
  10. Default: 10.0.0.0/16
  11. Description: CIDR block for VPC.
  12. Type: String
  13. AvailabilityZoneCount:
  14. ConstraintDescription: "The number of availability zones. (Min: 1, Max: 3)"
  15. MinValue: 1
  16. MaxValue: 3
  17. Default: 1
  18. Description: "How many AZs to create VPC subnets for. (Min: 1, Max: 3)"
  19. Type: Number
  20. SubnetBits:
  21. ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/19-27.
  22. MinValue: 5
  23. MaxValue: 13
  24. Default: 12
  25. Description: "Size of each subnet to create within the availability zones. (Min: 5 = /27, Max: 13 = /19)"
  26. Type: Number
  27. Metadata:
  28. AWS::CloudFormation::Interface:
  29. ParameterGroups:
  30. - Label:
  31. default: "Network Configuration"
  32. Parameters:
  33. - VpcCidr
  34. - SubnetBits
  35. - Label:
  36. default: "Availability Zones"
  37. Parameters:
  38. - AvailabilityZoneCount
  39. ParameterLabels:
  40. ClusterName:
  41. default: ""
  42. AvailabilityZoneCount:
  43. default: "Availability Zone Count"
  44. VpcCidr:
  45. default: "VPC CIDR"
  46. SubnetBits:
  47. default: "Bits Per Subnet"
  48. Conditions:
  49. DoAz3: !Equals [3, !Ref AvailabilityZoneCount]
  50. DoAz2: !Or [!Equals [2, !Ref AvailabilityZoneCount], Condition: DoAz3]
  51. Resources:
  52. VPC:
  53. Type: "AWS::EC2::VPC"
  54. Properties:
  55. EnableDnsSupport: "true"
  56. EnableDnsHostnames: "true"
  57. CidrBlock: !Ref VpcCidr
  58. Tags:
  59. - Key: Name
  60. Value: !Join [ "", [ !Ref ClusterName, "-vpc" ] ]
  61. - Key: !Join [ "", [ "kubernetes.io/cluster/unmanaged" ] ]
  62. Value: "shared"
  63. PublicSubnet:
  64. Type: "AWS::EC2::Subnet"
  65. Properties:
  66. VpcId: !Ref VPC
  67. CidrBlock: !Select [0, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  68. AvailabilityZone: !Select
  69. - 0
  70. - Fn::GetAZs: !Ref "AWS::Region"
  71. Tags:
  72. - Key: Name
  73. Value: !Join [ "", [ !Ref ClusterName, "-public-1" ] ]
  74. PublicSubnet2:
  75. Type: "AWS::EC2::Subnet"
  76. Condition: DoAz2
  77. Properties:
  78. VpcId: !Ref VPC
  79. CidrBlock: !Select [1, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  80. AvailabilityZone: !Select
  81. - 1
  82. - Fn::GetAZs: !Ref "AWS::Region"
  83. Tags:
  84. - Key: Name
  85. Value: !Join [ "", [ !Ref ClusterName, "-public-2" ] ]
  86. PublicSubnet3:
  87. Type: "AWS::EC2::Subnet"
  88. Condition: DoAz3
  89. Properties:
  90. VpcId: !Ref VPC
  91. CidrBlock: !Select [2, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  92. AvailabilityZone: !Select
  93. - 2
  94. - Fn::GetAZs: !Ref "AWS::Region"
  95. Tags:
  96. - Key: Name
  97. Value: !Join [ "", [ !Ref ClusterName, "-public-3" ] ]
  98. InternetGateway:
  99. Type: "AWS::EC2::InternetGateway"
  100. Properties:
  101. Tags:
  102. - Key: Name
  103. Value: !Join [ "", [ !Ref ClusterName, "-igw" ] ]
  104. GatewayToInternet:
  105. Type: "AWS::EC2::VPCGatewayAttachment"
  106. Properties:
  107. VpcId: !Ref VPC
  108. InternetGatewayId: !Ref InternetGateway
  109. PublicRouteTable:
  110. Type: "AWS::EC2::RouteTable"
  111. Properties:
  112. VpcId: !Ref VPC
  113. Tags:
  114. - Key: Name
  115. Value: !Join [ "", [ !Ref ClusterName, "-rtb-public" ] ]
  116. PublicRoute:
  117. Type: "AWS::EC2::Route"
  118. DependsOn: GatewayToInternet
  119. Properties:
  120. RouteTableId: !Ref PublicRouteTable
  121. DestinationCidrBlock: 0.0.0.0/0
  122. GatewayId: !Ref InternetGateway
  123. PublicSubnetRouteTableAssociation:
  124. Type: "AWS::EC2::SubnetRouteTableAssociation"
  125. Properties:
  126. SubnetId: !Ref PublicSubnet
  127. RouteTableId: !Ref PublicRouteTable
  128. PublicSubnetRouteTableAssociation2:
  129. Type: "AWS::EC2::SubnetRouteTableAssociation"
  130. Properties:
  131. SubnetId: !Ref PublicSubnet2
  132. RouteTableId: !Ref PublicRouteTable
  133. PublicSubnetRouteTableAssociation3:
  134. Type: "AWS::EC2::SubnetRouteTableAssociation"
  135. Properties:
  136. SubnetId: !Ref PublicSubnet3
  137. RouteTableId: !Ref PublicRouteTable
  138. PrivateSubnet:
  139. Type: "AWS::EC2::Subnet"
  140. Properties:
  141. VpcId: !Ref VPC
  142. CidrBlock: !Select [3, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  143. AvailabilityZone: !Select
  144. - 0
  145. - Fn::GetAZs: !Ref "AWS::Region"
  146. Tags:
  147. - Key: Name
  148. Value: !Join [ "", [ !Ref ClusterName, "-private-1" ] ]
  149. PrivateRouteTable:
  150. Type: "AWS::EC2::RouteTable"
  151. Properties:
  152. VpcId: !Ref VPC
  153. Tags:
  154. - Key: Name
  155. Value: !Join [ "", [ !Ref ClusterName, "-rtb-private-1" ] ]
  156. PrivateSubnetRouteTableAssociation:
  157. Type: "AWS::EC2::SubnetRouteTableAssociation"
  158. Properties:
  159. SubnetId: !Ref PrivateSubnet
  160. RouteTableId: !Ref PrivateRouteTable
  161. NAT:
  162. DependsOn:
  163. - GatewayToInternet
  164. Type: "AWS::EC2::NatGateway"
  165. Properties:
  166. AllocationId:
  167. "Fn::GetAtt":
  168. - EIP
  169. - AllocationId
  170. SubnetId: !Ref PublicSubnet
  171. Tags:
  172. - Key: Name
  173. Value: !Join [ "", [ !Ref ClusterName, "-natgw-private-1" ] ]
  174. EIP:
  175. Type: "AWS::EC2::EIP"
  176. Properties:
  177. Domain: vpc
  178. Route:
  179. Type: "AWS::EC2::Route"
  180. Properties:
  181. RouteTableId:
  182. Ref: PrivateRouteTable
  183. DestinationCidrBlock: 0.0.0.0/0
  184. NatGatewayId:
  185. Ref: NAT
  186. PrivateSubnet2:
  187. Type: "AWS::EC2::Subnet"
  188. Condition: DoAz2
  189. Properties:
  190. VpcId: !Ref VPC
  191. CidrBlock: !Select [4, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  192. AvailabilityZone: !Select
  193. - 1
  194. - Fn::GetAZs: !Ref "AWS::Region"
  195. Tags:
  196. - Key: Name
  197. Value: !Join [ "", [ !Ref ClusterName, "-private-2" ] ]
  198. PrivateRouteTable2:
  199. Type: "AWS::EC2::RouteTable"
  200. Condition: DoAz2
  201. Properties:
  202. VpcId: !Ref VPC
  203. Tags:
  204. - Key: Name
  205. Value: !Join [ "", [ !Ref ClusterName, "-rtb-private-2" ] ]
  206. PrivateSubnetRouteTableAssociation2:
  207. Type: "AWS::EC2::SubnetRouteTableAssociation"
  208. Condition: DoAz2
  209. Properties:
  210. SubnetId: !Ref PrivateSubnet2
  211. RouteTableId: !Ref PrivateRouteTable2
  212. NAT2:
  213. DependsOn:
  214. - GatewayToInternet
  215. Type: "AWS::EC2::NatGateway"
  216. Condition: DoAz2
  217. Properties:
  218. AllocationId:
  219. "Fn::GetAtt":
  220. - EIP2
  221. - AllocationId
  222. SubnetId: !Ref PublicSubnet2
  223. Tags:
  224. - Key: Name
  225. Value: !Join [ "", [ !Ref ClusterName, "-natgw-private-2" ] ]
  226. EIP2:
  227. Type: "AWS::EC2::EIP"
  228. Condition: DoAz2
  229. Properties:
  230. Domain: vpc
  231. Tags:
  232. - Key: Name
  233. Value: !Join [ "", [ !Ref ClusterName, "-eip-private-2" ] ]
  234. Route2:
  235. Type: "AWS::EC2::Route"
  236. Condition: DoAz2
  237. Properties:
  238. RouteTableId:
  239. Ref: PrivateRouteTable2
  240. DestinationCidrBlock: 0.0.0.0/0
  241. NatGatewayId:
  242. Ref: NAT2
  243. PrivateSubnet3:
  244. Type: "AWS::EC2::Subnet"
  245. Condition: DoAz3
  246. Properties:
  247. VpcId: !Ref VPC
  248. CidrBlock: !Select [5, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
  249. AvailabilityZone: !Select
  250. - 2
  251. - Fn::GetAZs: !Ref "AWS::Region"
  252. Tags:
  253. - Key: Name
  254. Value: !Join [ "", [ !Ref ClusterName, "-private-3" ] ]
  255. PrivateRouteTable3:
  256. Type: "AWS::EC2::RouteTable"
  257. Condition: DoAz3
  258. Properties:
  259. VpcId: !Ref VPC
  260. Tags:
  261. - Key: Name
  262. Value: !Join [ "", [ !Ref ClusterName, "-rtb-private-3" ] ]
  263. PrivateSubnetRouteTableAssociation3:
  264. Type: "AWS::EC2::SubnetRouteTableAssociation"
  265. Condition: DoAz3
  266. Properties:
  267. SubnetId: !Ref PrivateSubnet3
  268. RouteTableId: !Ref PrivateRouteTable3
  269. NAT3:
  270. DependsOn:
  271. - GatewayToInternet
  272. Type: "AWS::EC2::NatGateway"
  273. Condition: DoAz3
  274. Properties:
  275. AllocationId:
  276. "Fn::GetAtt":
  277. - EIP3
  278. - AllocationId
  279. SubnetId: !Ref PublicSubnet3
  280. Tags:
  281. - Key: Name
  282. Value: !Join [ "", [ !Ref ClusterName, "-natgw-private-3" ] ]
  283. EIP3:
  284. Type: "AWS::EC2::EIP"
  285. Condition: DoAz3
  286. Properties:
  287. Domain: vpc
  288. Tags:
  289. - Key: Name
  290. Value: !Join [ "", [ !Ref ClusterName, "-eip-private-3" ] ]
  291. Route3:
  292. Type: "AWS::EC2::Route"
  293. Condition: DoAz3
  294. Properties:
  295. RouteTableId:
  296. Ref: PrivateRouteTable3
  297. DestinationCidrBlock: 0.0.0.0/0
  298. NatGatewayId:
  299. Ref: NAT3
  300. S3Endpoint:
  301. Type: AWS::EC2::VPCEndpoint
  302. Properties:
  303. PolicyDocument:
  304. Version: 2012-10-17
  305. Statement:
  306. - Effect: Allow
  307. Principal: '*'
  308. Action:
  309. - '*'
  310. Resource:
  311. - '*'
  312. RouteTableIds:
  313. - !Ref PublicRouteTable
  314. - !Ref PrivateRouteTable
  315. - !If [DoAz2, !Ref PrivateRouteTable2, !Ref "AWS::NoValue"]
  316. - !If [DoAz3, !Ref PrivateRouteTable3, !Ref "AWS::NoValue"]
  317. ServiceName: !Join
  318. - ''
  319. - - com.amazonaws.
  320. - !Ref 'AWS::Region'
  321. - .s3
  322. VpcId: !Ref VPC
  323. Outputs:
  324. VpcId:
  325. Description: ID of the new VPC.
  326. Value: !Ref VPC
  327. PublicSubnetIds:
  328. Description: Subnet IDs of the public subnets.
  329. Value:
  330. !Join [
  331. ",",
  332. [!Ref PublicSubnet, !If [DoAz2, !Ref PublicSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PublicSubnet3, !Ref "AWS::NoValue"]]
  333. ]
  334. PrivateSubnetIds:
  335. Description: Subnet IDs of the private subnets.
  336. Value:
  337. !Join [
  338. ",",
  339. [!Ref PrivateSubnet, !If [DoAz2, !Ref PrivateSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PrivateSubnet3, !Ref "AWS::NoValue"]]
  340. ]
  341. PublicRouteTableId:
  342. Description: Public Route table ID
  343. Value: !Ref PublicRouteTable
  344. PrivateRouteTableId:
  345. Description: Private Route table ID
  346. Value: !Ref PrivateRouteTable

Creating a subnet in AWS Local Zones

You must create a subnet in AWS Local Zones before you configure a worker machineset for your OKD cluster.

You must repeat the following process for each Local Zone you want to deploy worker nodes to.

You can use the provided CloudFormation template and a custom parameter file to create a stack of AWS resources that represent the subnet.

If you do not use the provided CloudFormation template to create your AWS infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • You configured an AWS account.

  • You added your AWS keys and region to your local AWS profile by running aws configure.

  • You opted in to the Local Zone group.

Procedure

  1. Create a JSON file that contains the parameter values that the template requires:

    1. [
    2. {
    3. "ParameterKey": "ClusterName", (1)
    4. "ParameterValue": "mycluster" (2)
    5. },
    6. {
    7. "ParameterKey": "VpcId", (3)
    8. "ParameterValue": "vpc-<random_string>" (4)
    9. },
    10. {
    11. "ParameterKey": "PublicRouteTableId", (5)
    12. "ParameterValue": "<vpc_rtb_pub>" (6)
    13. },
    14. {
    15. "ParameterKey": "LocalZoneName", (7)
    16. "ParameterValue": "<cluster_region_name>-<location_identifier>-<zone_identifier>" (8)
    17. },
    18. {
    19. "ParameterKey": "LocalZoneNameShort", (9)
    20. "ParameterValue": "<lz_zone_shortname>" (10)
    21. },
    22. {
    23. "ParameterKey": "PublicSubnetCidr", (11)
    24. "ParameterValue": "10.0.128.0/20" (12)
    25. }
    26. ]
    1A short, representative cluster name to use for hostnames, etc.
    2Specify the cluster name that you used when you generated the install-config.yaml file for the cluster.
    3The VPC ID in which the Local Zone’s subnet will be created.
    4Specify the VpcId value from the output of the CloudFormation template for the VPC.
    5The Public Route Table ID for the VPC.
    6Specify the PublicRouteTableId value from the output of the CloudFormation template for the VPC.
    7The Local Zone name that the VPC belongs to.
    8Specify the Local Zone that you opted your AWS account into, such as us-east-1-nyc-1a.
    9The shortname of the AWS Local Zone that the VPC belongs to.
    10Specify a short name for the AWS Local Zone that you opted your AWS account into, such as <zone_group_identified><zone_identifier>. For example, us-east-1-nyc-1a is shortened to nyc-1a.
    11The CIDR block to allow access to the Local Zone.
    12Specify a CIDR block in the format x.x.x.x/16-24.
  2. Copy the template from the CloudFormation template for the subnet section of this topic and save it as a YAML file on your computer. This template describes the VPC that your cluster requires.

  3. Launch the CloudFormation template to create a stack of AWS resources that represent the VPC by running the following command:

    You must enter the command on a single line.

    1. $ aws cloudformation create-stack --stack-name <subnet_stack_name> \ (1)
    2. --template-body file://<template>.yaml \ (2)
    3. --parameters file://<parameters>.json (3)
    1<subnet_stack_name> is the name for the CloudFormation stack, such as cluster-lz-<local_zone_shortname>. You need the name of this stack if you remove the cluster.
    2<template> is the relative path to and name of the CloudFormation template YAML file that you saved.
    3<parameters> is the relative path to and name of the CloudFormation parameters JSON file.

    Example output

    1. arn:aws:cloudformation:us-east-1:123456789012:stack/cluster-lz-nyc1/dbedae40-2fd3-11eb-820e-12a48460849f
  4. Confirm that the template components exist by running the following command:

    1. $ aws cloudformation describe-stacks --stack-name <subnet_stack_name>

    After the StackStatus displays CREATE_COMPLETE, the output displays values for the following parameters. You must provide these parameter values to the other CloudFormation templates that you run to create your cluster:

    PublicSubnetIds

    The IDs of the new public subnets.

CloudFormation template for the subnet that uses AWS Local Zones

You can use the following CloudFormation template to deploy the subnet that you need for your OKD cluster that uses AWS Local Zones.

CloudFormation template for the subnet

  1. # CloudFormation template used to create Local Zone subnets and dependencies
  2. AWSTemplateFormatVersion: 2010-09-09
  3. Description: Template for Best Practice VPC with 1-3 AZs
  4. Parameters:
  5. ClusterName:
  6. Description: ClusterName used to prefix resource names
  7. Type: String
  8. VpcId:
  9. Description: VPC Id
  10. Type: String
  11. LocalZoneName:
  12. Description: Local Zone Name (Example us-east-1-bos-1)
  13. Type: String
  14. LocalZoneNameShort:
  15. Description: Short name for Local Zone used on tag Name (Example bos1)
  16. Type: String
  17. PublicRouteTableId:
  18. Description: Public Route Table ID to associate the Local Zone subnet
  19. Type: String
  20. PublicSubnetCidr:
  21. AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
  22. ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
  23. Default: 10.0.128.0/20
  24. Description: CIDR block for Public Subnet
  25. Type: String
  26. Resources:
  27. PublicSubnet:
  28. Type: "AWS::EC2::Subnet"
  29. Properties:
  30. VpcId: !Ref VpcId
  31. CidrBlock: !Ref PublicSubnetCidr
  32. AvailabilityZone: !Ref LocalZoneName
  33. Tags:
  34. - Key: Name
  35. Value: !Join
  36. - ""
  37. - [ !Ref ClusterName, "-public-", !Ref LocalZoneNameShort, "-1" ]
  38. - Key: kubernetes.io/cluster/unmanaged
  39. Value: "true"
  40. PublicSubnetRouteTableAssociation:
  41. Type: "AWS::EC2::SubnetRouteTableAssociation"
  42. Properties:
  43. SubnetId: !Ref PublicSubnet
  44. RouteTableId: !Ref PublicRouteTableId
  45. Outputs:
  46. PublicSubnetIds:
  47. Description: Subnet IDs of the public subnets.
  48. Value:
  49. !Join [
  50. "",
  51. [!Ref PublicSubnet]
  52. ]

Additional resources

Obtaining the installation program

Before you install OKD, download the installation file on the host you are using for installation.

Prerequisites

  • You have a computer that runs Linux or macOS, with 500 MB of local disk space.

Procedure

  1. Download installer from https://github.com/openshift/okd/releases

    The installation program creates several files on the computer that you use to install your cluster. You must keep the installation program and the files that the installation program creates after you finish installing the cluster. Both files are required to delete the cluster.

    Deleting the files created by the installation program does not remove your cluster, even if the cluster failed during installation. To remove your cluster, complete the OKD uninstallation procedures for your specific cloud provider.

  2. Extract the installation program. For example, on a computer that uses a Linux operating system, run the following command:

    1. $ tar -xvf openshift-install-linux.tar.gz
  3. Download your installation pull secret from the Red Hat OpenShift Cluster Manager. This pull secret allows you to authenticate with the services that are provided by the included authorities, including Quay.io, which serves the container images for OKD components.

    Using a pull secret from the Red Hat OpenShift Cluster Manager is not required. You can use a pull secret for another private registry. Or, if you do not need the cluster to pull images from a private registry, you can use {"auths":{"fake":{"auth":"aWQ6cGFzcwo="}}} as the pull secret when prompted during the installation.

    If you do not use the pull secret from the Red Hat OpenShift Cluster Manager:

    • Red Hat Operators are not available.

    • The Telemetry and Insights operators do not send data to Red Hat.

    • Content from the Red Hat Container Catalog registry, such as image streams and Operators, are not available.

Generating a key pair for cluster node SSH access

During an OKD installation, you can provide an SSH public key to the installation program. The key is passed to the Fedora CoreOS (FCOS) nodes through their Ignition config files and is used to authenticate SSH access to the nodes. The key is added to the ~/.ssh/authorized_keys list for the core user on each node, which enables password-less authentication.

After the key is passed to the nodes, you can use the key pair to SSH in to the FCOS nodes as the user core. To access the nodes through SSH, the private key identity must be managed by SSH for your local user.

If you want to SSH in to your cluster nodes to perform installation debugging or disaster recovery, you must provide the SSH public key during the installation process. The ./openshift-install gather command also requires the SSH public key to be in place on the cluster nodes.

Do not skip this procedure in production environments, where disaster recovery and debugging is required.

You must use a local key, not one that you configured with platform-specific approaches such as AWS key pairs.

On clusters running Fedora CoreOS (FCOS), the SSH keys specified in the Ignition config files are written to the /home/core/.ssh/authorized_keys.d/core file. However, the Machine Config Operator manages SSH keys in the /home/core/.ssh/authorized_keys file and configures sshd to ignore the /home/core/.ssh/authorized_keys.d/core file. As a result, newly provisioned OKD nodes are not accessible using SSH until the Machine Config Operator reconciles the machine configs with the authorized_keys file. After you can access the nodes using SSH, you can delete the /home/core/.ssh/authorized_keys.d/core file.

Procedure

  1. If you do not have an existing SSH key pair on your local machine to use for authentication onto your cluster nodes, create one. For example, on a computer that uses a Linux operating system, run the following command:

    1. $ ssh-keygen -t ed25519 -N '' -f <path>/<file_name> (1)
    1Specify the path and file name, such as ~/.ssh/id_ed25519, of the new SSH key. If you have an existing key pair, ensure your public key is in the your ~/.ssh directory.

    If you plan to install an OKD cluster that uses FIPS Validated / Modules in Process cryptographic libraries on the x86_64 architecture, do not create a key that uses the ed25519 algorithm. Instead, create a key that uses the rsa or ecdsa algorithm.

  2. View the public SSH key:

    1. $ cat <path>/<file_name>.pub

    For example, run the following to view the ~/.ssh/id_ed25519.pub public key:

    1. $ cat ~/.ssh/id_ed25519.pub
  3. Add the SSH private key identity to the SSH agent for your local user, if it has not already been added. SSH agent management of the key is required for password-less SSH authentication onto your cluster nodes, or if you want to use the ./openshift-install gather command.

    On some distributions, default SSH private key identities such as ~/.ssh/id_rsa and ~/.ssh/id_dsa are managed automatically.

    1. If the ssh-agent process is not already running for your local user, start it as a background task:

      1. $ eval "$(ssh-agent -s)"

      Example output

      1. Agent pid 31874

      If your cluster is in FIPS mode, only use FIPS-compliant algorithms to generate the SSH key. The key must be either RSA or ECDSA.

  4. Add your SSH private key to the ssh-agent:

    1. $ ssh-add <path>/<file_name> (1)
    1Specify the path and file name for your SSH private key, such as ~/.ssh/id_ed25519

    Example output

    1. Identity added: /home/<you>/<path>/<file_name> (<computer_name>)

Next steps

  • When you install OKD, provide the SSH public key to the installation program.

Creating the installation files for AWS

To install OKD on Amazon Web Services (AWS) and use AWS Local Zones, you must generate the files that the installation program needs to deploy your cluster and modify them so that the cluster creates only the machines that it will use. You generate and customize the install-config.yaml file and Kubernetes manifests.

Minimum resource requirements for cluster installation

Each cluster machine must meet the following minimum requirements:

Table 1. Minimum resource requirements
MachineOperating SystemvCPU [1]Virtual RAMStorageIOPS [2]

Bootstrap

FCOS

4

16 GB

100 GB

300

Control plane

FCOS

4

16 GB

100 GB

300

Compute

FCOS

2

8 GB

100 GB

300

  1. One vCPU is equivalent to one physical core when simultaneous multithreading (SMT), or hyperthreading, is not enabled. When enabled, use the following formula to calculate the corresponding ratio: (threads per core × cores) × sockets = vCPUs.

  2. OKD and Kubernetes are sensitive to disk performance, and faster storage is recommended, particularly for etcd on the control plane nodes which require a 10 ms p99 fsync duration. Note that on many cloud platforms, storage size and IOPS scale together, so you might need to over-allocate storage volume to obtain sufficient performance.

  3. As with all user-provisioned installations, if you choose to use Fedora compute machines in your cluster, you take responsibility for all operating system life cycle management and maintenance, including performing system updates, applying patches, and completing all other required tasks. Use of Fedora 7 compute machines is deprecated and has been removed in OKD 4.10 and later.

If an instance type for your platform meets the minimum requirements for cluster machines, it is supported to use in OKD.

Tested instance types for AWS

The following Amazon Web Services (AWS) instance types have been tested with OKD for use with AWS Local Zones.

Use the machine types included in the following charts for your AWS instances. If you use an instance type that is not listed in the chart, ensure that the instance size you use matches the minimum resource requirements that are listed in “Minimum resource requirements for cluster installation”.

Machine types based on x86_64 architecture for AWS Local Zones

  • c5.2xlarge

  • c5d.2xlarge

  • m5.xlarge

  • m5.2xlarge

  • t3.xlarge

Creating the installation configuration file

Generate and customize the installation configuration file that the installation program needs to deploy your cluster.

Prerequisites

  • You obtained the OKD installation program and the pull secret for your cluster.

  • You checked that you are deploying your cluster to a region with an accompanying Fedora CoreOS (FCOS) AMI published by Red Hat. If you are deploying to a region that requires a custom AMI, such as an AWS GovCloud region, you must create the install-config.yaml file manually.

Procedure

  1. Create the install-config.yaml file.

    1. Change to the directory that contains the installation program and run the following command:

      1. $ ./openshift-install create install-config --dir <installation_directory> (1)
      1For <installation_directory>, specify the directory name to store the files that the installation program creates.

      Specify an empty directory. Some installation assets, like bootstrap X.509 certificates have short expiration intervals, so you must not reuse an installation directory. If you want to reuse individual files from another cluster installation, you can copy them into your directory. However, the file names for the installation assets might change between releases. Use caution when copying installation files from an earlier OKD version.

    2. At the prompts, provide the configuration details for your cloud:

      1. Optional: Select an SSH key to use to access your cluster machines.

        For production OKD clusters on which you want to perform installation debugging or disaster recovery, specify an SSH key that your ssh-agent process uses.

      2. Select aws as the platform to target.

      3. If you do not have an AWS profile stored on your computer, enter the AWS access key ID and secret access key for the user that you configured to run the installation program.

        The AWS access key ID and secret access key are stored in ~/.aws/credentials in the home directory of the current user on the installation host. You are prompted for the credentials by the installation program if the credentials for the exported profile are not present in the file. Any credentials that you provide to the installation program are stored in the file.

      4. Select the AWS region to deploy the cluster to. The region that you specify must be the same region that contains the Local Zone that you opted into for your AWS account.

      5. Select the base domain for the Route 53 service that you configured for your cluster.

      6. Enter a descriptive name for your cluster.

      7. Paste the pull secret from the Red Hat OpenShift Cluster Manager. This field is optional.

  1. Edit the install-config.yaml file to provide the subnets for the availability zones that your VPC uses:

    1. platform:
    2. aws:
    3. subnets: (1)
    4. - publicSubnetId-1
    5. - publicSubnetId-2
    6. - publicSubnetId-3
    7. - privateSubnetId-1
    8. - privateSubnetId-2
    9. - privateSubnetId-3
    1Add the subnets section and specify the PrivateSubnetIds and PublicSubnetIds values from the outputs of the CloudFormation template for the VPC. Do not include the Local Zone subnets here.
  2. Optional: Back up the install-config.yaml file.

    The install-config.yaml file is consumed during the installation process. If you want to reuse the file, you must back it up now.

Additional resources

Creating the Kubernetes manifest files

Because you must modify some cluster definition files and manually start the cluster machines, you must generate the Kubernetes manifest files that the cluster needs to configure the machines.

Prerequisites

  • You obtained the OKD installation program.

  • You created the install-config.yaml installation configuration file.

  • You installed the jq package.

Procedure

  1. Change to the directory that contains the OKD installation program and generate the Kubernetes manifests for the cluster by running the following command:

    1. $ ./openshift-install create manifests --dir <installation_directory> (1)
    1For <installation_directory>, specify the installation directory that contains the install-config.yaml file you created.
  2. Create the machine set manifests for the worker nodes in your Local Zone.

    1. Export a local variable that contains the name of the Local Zone that you opted your AWS account into by running the following command:

      1. $ export LZ_ZONE_NAME="<local_zone_name>" (1)
      1For <local_zone_name>, specify the Local Zone that you opted your AWS account into, such as us-east-1-nyc-1a.
    2. Review the instance types for the location that you will deploy to by running the following command:

      1. $ aws ec2 describe-instance-type-offerings \
      2. --location-type availability-zone \
      3. --filters Name=location,Values=${LZ_ZONE_NAME}
      4. --region <region> (1)
      1For <region>, specify the name of the region that you will deploy to, such as us-east-1.
    3. Export a variable to define the instance type for the worker machines to deploy on the Local Zone subnet by running the following command:

      1. $ export INSTANCE_TYPE="<instance_type>" (1)
      1Set <instance_type> to a tested instance type, such as c5d.2xlarge.
    4. Store the AMI ID as a local variable by running the following command:

      1. $ export AMI_ID=$(grep ami
      2. <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-0.yaml \
      3. | tail -n1 | awk '{print$2}')
    5. Store the subnet ID as a local variable by running the following command:

      1. $ export SUBNET_ID=$(aws cloudformation describe-stacks \
      2. --stack-name "<subnet_stack_name>" \ (1)
      3. | jq -r .Stacks[0].Outputs[0].OutputValue)
      1For <subnet_stack_name>, specify the name of the subnet stack that you created.
    6. Store the cluster ID as local variable by running the following command:

      1. $ export CLUSTER_ID="$(awk '/infrastructureName: / {print $2}' <installation_directory>/manifests/cluster-infrastructure-02-config.yml)"
    7. Create the worker manifest file for the Local Zone that your VPC uses by running the following command:

      1. $ cat <<EOF > <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-nyc1.yaml
      2. apiVersion: machine.openshift.io/v1beta1
      3. kind: MachineSet
      4. metadata:
      5. labels:
      6. machine.openshift.io/cluster-api-cluster: ${CLUSTER_ID}
      7. name: ${CLUSTER_ID}-edge-${LZ_ZONE_NAME}
      8. namespace: openshift-machine-api
      9. spec:
      10. replicas: 1
      11. selector:
      12. matchLabels:
      13. machine.openshift.io/cluster-api-cluster: ${CLUSTER_ID}
      14. machine.openshift.io/cluster-api-machineset: ${CLUSTER_ID}-edge-${LZ_ZONE_NAME}
      15. template:
      16. metadata:
      17. labels:
      18. machine.openshift.io/cluster-api-cluster: ${CLUSTER_ID}
      19. machine.openshift.io/cluster-api-machine-role: edge
      20. machine.openshift.io/cluster-api-machine-type: edge
      21. machine.openshift.io/cluster-api-machineset: ${CLUSTER_ID}-edge-${LZ_ZONE_NAME}
      22. spec:
      23. metadata:
      24. labels:
      25. zone_type: local-zone
      26. zone_group: ${LZ_ZONE_NAME::-1}
      27. node-role.kubernetes.io/edge: ""
      28. taints:
      29. - key: node-role.kubernetes.io/edge
      30. effect: NoSchedule
      31. providerSpec:
      32. value:
      33. ami:
      34. id: ${AMI_ID}
      35. apiVersion: machine.openshift.io/v1beta1
      36. blockDevices:
      37. - ebs:
      38. volumeSize: 120
      39. volumeType: gp2
      40. credentialsSecret:
      41. name: aws-cloud-credentials
      42. deviceIndex: 0
      43. iamInstanceProfile:
      44. id: ${CLUSTER_ID}-worker-profile
      45. instanceType: ${INSTANCE_TYPE}
      46. kind: AWSMachineProviderConfig
      47. placement:
      48. availabilityZone: ${LZ_ZONE_NAME}
      49. region: ${CLUSTER_REGION}
      50. securityGroups:
      51. - filters:
      52. - name: tag:Name
      53. values:
      54. - ${CLUSTER_ID}-worker-sg
      55. subnet:
      56. id: ${SUBNET_ID}
      57. publicIp: true
      58. tags:
      59. - name: kubernetes.io/cluster/${CLUSTER_ID}
      60. value: owned
      61. userDataSecret:
      62. name: worker-user-data
      63. EOF

Deploying the cluster

You can install OKD on a compatible cloud platform.

You can run the create cluster command of the installation program only once, during initial installation.

Prerequisites

  • Configure an account with the cloud platform that hosts your cluster.

  • Obtain the OKD installation program and the pull secret for your cluster.

Procedure

  1. Change to the directory that contains the installation program and initialize the cluster deployment:

    1. $ ./openshift-install create cluster --dir <installation_directory> \ (1)
    2. --log-level=info (2)
    1For <installation_directory>, specify the location of your customized ./install-config.yaml file.
    2To view different installation details, specify warn, debug, or error instead of info.

    If the cloud provider account that you configured on your host does not have sufficient permissions to deploy the cluster, the installation process stops, and the missing permissions are displayed.

  2. Optional: Remove or disable the AdministratorAccess policy from the IAM account that you used to install the cluster.

    The elevated permissions provided by the AdministratorAccess policy are required only during installation.

Verification

When the cluster deployment completes successfully:

  • The terminal displays directions for accessing your cluster, including a link to the web console and credentials for the kubeadmin user.

  • Credential information also outputs to <installation_directory>/.openshift_install.log.

Do not delete the installation program or the files that the installation program creates. Both are required to delete the cluster.

Example output

  1. ...
  2. INFO Install complete!
  3. INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=/home/myuser/install_dir/auth/kubeconfig'
  4. INFO Access the OpenShift web-console here: https://console-openshift-console.apps.mycluster.example.com
  5. INFO Login to the console with user: "kubeadmin", and password: "4vYBz-Ee6gm-ymBZj-Wt5AL"
  6. INFO Time elapsed: 36m22s
  • The Ignition config files that the installation program generates contain certificates that expire after 24 hours, which are then renewed at that time. If the cluster is shut down before renewing the certificates and the cluster is later restarted after the 24 hours have elapsed, the cluster automatically recovers the expired certificates. The exception is that you must manually approve the pending node-bootstrapper certificate signing requests (CSRs) to recover kubelet certificates. See the documentation for Recovering from expired control plane certificates for more information.

  • It is recommended that you use Ignition config files within 12 hours after they are generated because the 24-hour certificate rotates from 16 to 22 hours after the cluster is installed. By using the Ignition config files within 12 hours, you can avoid installation failure if the certificate update runs during installation.

Installing the OpenShift CLI by downloading the binary

You can install the OpenShift CLI (oc) to interact with OKD from a command-line interface. You can install oc on Linux, Windows, or macOS.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD 4.12. Download and install the new version of oc.

Installing the OpenShift CLI on Linux

You can install the OpenShift CLI (oc) binary on Linux by using the following procedure.

Procedure

  1. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack the archive:

    1. $ tar xvzf <file>
  4. Place the oc binary in a directory that is on your PATH.

    To check your PATH, execute the following command:

    1. $ echo $PATH

After you install the OpenShift CLI, it is available using the oc command:

  1. $ oc <command>

Installing the OpenShift CLI on Windows

You can install the OpenShift CLI (oc) binary on Windows by using the following procedure.

Procedure

  1. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.zip.

  3. Unzip the archive with a ZIP program.

  4. Move the oc binary to a directory that is on your PATH.

    To check your PATH, open the command prompt and execute the following command:

    1. C:\> path

After you install the OpenShift CLI, it is available using the oc command:

  1. C:\> oc <command>

Installing the OpenShift CLI on macOS

You can install the OpenShift CLI (oc) binary on macOS by using the following procedure.

Procedure

  1. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack and unzip the archive.

  4. Move the oc binary to a directory on your PATH.

    To check your PATH, open a terminal and execute the following command:

    1. $ echo $PATH

After you install the OpenShift CLI, it is available using the oc command:

  1. $ oc <command>

Logging in to the cluster by using the CLI

You can log in to your cluster as a default system user by exporting the cluster kubeconfig file. The kubeconfig file contains information about the cluster that is used by the CLI to connect a client to the correct cluster and API server. The file is specific to a cluster and is created during OKD installation.

Prerequisites

  • You deployed an OKD cluster.

  • You installed the oc CLI.

Procedure

  1. Export the kubeadmin credentials:

    1. $ export KUBECONFIG=<installation_directory>/auth/kubeconfig (1)
    1For <installation_directory>, specify the path to the directory that you stored the installation files in.
  2. Verify you can run oc commands successfully using the exported configuration:

    1. $ oc whoami

    Example output

    1. system:admin

Logging in to the cluster by using the web console

The kubeadmin user exists by default after an OKD installation. You can log in to your cluster as the kubeadmin user by using the OKD web console.

Prerequisites

  • You have access to the installation host.

  • You completed a cluster installation and all cluster Operators are available.

Procedure

  1. Obtain the password for the kubeadmin user from the kubeadmin-password file on the installation host:

    1. $ cat <installation_directory>/auth/kubeadmin-password

    Alternatively, you can obtain the kubeadmin password from the <installation_directory>/.openshift_install.log log file on the installation host.

  2. List the OKD web console route:

    1. $ oc get routes -n openshift-console | grep 'console-openshift'

    Alternatively, you can obtain the OKD route from the <installation_directory>/.openshift_install.log log file on the installation host.

    Example output

    1. console console-openshift-console.apps.<cluster_name>.<base_domain> console https reencrypt/Redirect None
  3. Navigate to the route detailed in the output of the preceding command in a web browser and log in as the kubeadmin user.

Additional resources

Additional resources

Additional resources

Next steps