|
4 | 4 | // * installing/installing_gcp/installing-restricted-networks-gcp.adoc |
5 | 5 | // * installing/installing_gcp/installing-gcp-user-infra-vpc.adoc |
6 | 6 |
|
7 | | -ifeval::["{context}" == "installing-gcp-user-infra-vpc"] |
8 | | -:shared-vpc: |
9 | | -endif::[] |
10 | | - |
11 | 7 | :_mod-docs-content-type: PROCEDURE |
12 | 8 | [id="installation-creating-gcp-control-plane_{context}"] |
13 | 9 | = Creating the control plane machines in {gcp-short} |
14 | 10 |
|
15 | | -You must create the control plane machines in {gcp-first} for |
16 | | -your cluster to use. One way to create these machines is to modify the |
17 | | -provided Deployment Manager template. |
| 11 | +[role="_abstract"] |
| 12 | +You must create the control plane machines in {gcp-first} for your cluster to use. One way to create these machines is to modify the provided Infrastructure Manager template. |
18 | 13 |
|
19 | 14 | [NOTE] |
20 | 15 | ==== |
21 | | -If you do not use the provided Deployment Manager template to create your |
22 | | -control plane machines, you must review the provided information and manually |
23 | | -create the infrastructure. If your cluster does not initialize correctly, you |
24 | | -might have to contact Red Hat support with your installation logs. |
| 16 | +If you do not use the provided template to create your control plane machines, 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. |
25 | 17 | ==== |
26 | 18 |
|
27 | 19 | .Prerequisites |
28 | 20 |
|
29 | | -* Ensure you defined the variables in the _Exporting common variables_, _Creating load balancers in {gcp-short}_, _Creating IAM roles in {gcp-short}_, and _Creating the bootstrap machine in {gcp-short}_ sections. |
30 | | -* Create the bootstrap machine. |
| 21 | +* You defined the variables in the _Exporting common variables_, _Creating load balancers in {gcp-short}_, _Creating IAM roles in {gcp-short}_, and _Creating the bootstrap machine in {gcp-short}_ sections. |
| 22 | +* You created the bootstrap machine. |
| 23 | +* You created the Ignition configuration files. |
31 | 24 |
|
32 | 25 | .Procedure |
33 | 26 |
|
34 | | -. Copy the template from the *Deployment Manager template for control plane machines* |
35 | | -section of this topic and save it as `05_control_plane.py` on your computer. |
36 | | -This template describes the control plane machines that your cluster requires. |
| 27 | +. Copy the template from the *Infrastructure Manager template for control plane machines* section of this topic and save it as `05_control_plane.tf` in a folder called `05_control_plane` on your computer. This template describes the control plane machines that your cluster requires. |
| 28 | + |
| 29 | +** You can edit the `05_control_plane.tf` file to add additional tags to the control plane machines, by modifying the existing `tags` stanza. The following example adds a custom tag to the first control plane machine, which is named `master_0`: |
| 30 | ++ |
| 31 | +[source,bash] |
| 32 | +---- |
| 33 | +resource "google_compute_instance" "master_0" { |
| 34 | +# ... |
| 35 | + tags = [ |
| 36 | + "${var.infra_id}-master" |
| 37 | + "custom_tag_example" |
| 38 | + ] |
| 39 | +# ... |
| 40 | +} |
| 41 | +---- |
37 | 42 |
|
38 | | -. Export the following variable required by the resource definition: |
| 43 | +. Copy the `master.ign` file from your installation directory into the `05_control_plane` folder by running the following command: |
39 | 44 | + |
40 | 45 | [source,terminal] |
41 | 46 | ---- |
42 | | -$ export MASTER_IGNITION=`cat <installation_directory>/master.ign` |
| 47 | +$ cp <installation_directory>/master.ign 05_control_plane/master.ign |
43 | 48 | ---- |
| 49 | +`<installation_directory>` specifies the directory where you created the Ignition configuration files. |
44 | 50 |
|
45 | | -. Create a `05_control_plane.yaml` resource definition file: |
| 51 | +. Create the control plane deployment by running the following command: |
46 | 52 | + |
47 | 53 | [source,terminal] |
48 | 54 | ---- |
49 | | -$ cat <<EOF >05_control_plane.yaml |
50 | | -imports: |
51 | | -- path: 05_control_plane.py |
52 | | - |
53 | | -resources: |
54 | | -- name: cluster-control-plane |
55 | | - type: 05_control_plane.py |
56 | | - properties: |
57 | | - infra_id: '${INFRA_ID}' <1> |
58 | | - zones: <2> |
59 | | - - '${ZONE_0}' |
60 | | - - '${ZONE_1}' |
61 | | - - '${ZONE_2}' |
62 | | - |
63 | | - control_subnet: '${CONTROL_SUBNET}' <3> |
64 | | - image: '${CLUSTER_IMAGE}' <4> |
65 | | - machine_type: 'n1-standard-4' <5> |
66 | | - root_volume_size: '128' |
67 | | - service_account_email: '${MASTER_SERVICE_ACCOUNT}' <6> |
68 | | - |
69 | | - ignition: '${MASTER_IGNITION}' <7> |
70 | | -EOF |
71 | | ----- |
72 | | -<1> `infra_id` is the `INFRA_ID` infrastructure name from the extraction step. |
73 | | -<2> `zones` are the zones to deploy the control plane instances into, for example `us-central1-a`, `us-central1-b`, and `us-central1-c`. |
74 | | -<3> `control_subnet` is the `selfLink` URL to the control subnet. |
75 | | -<4> `image` is the `selfLink` URL to the {op-system} image. |
76 | | -<5> `machine_type` is the machine type of the instance, for example `n1-standard-4`. |
77 | | -<6> `service_account_email` is the email address for the master service account that you created. |
78 | | -<7> `ignition` is the contents of the `master.ign` file. |
79 | | -
|
80 | | -. Create the deployment by using the `gcloud` CLI: |
| 55 | +$ gcloud infra-manager deployments apply <control_plane_deployment> \ |
| 56 | + --location=${REGION} \ |
| 57 | + --project=${PROJECT_NAME} \ |
| 58 | + --local-source=./05_control_plane \ |
| 59 | + --input-values=infra_id=${INFRA_ID},project=${PROJECT_NAME},region=${REGION},zone_0=${ZONE_0},zone_1=${ZONE_1},zone_2=${ZONE_2},subnet=${CONTROL_SUBNET},image=${CLUSTER_IMAGE},service_account_email=${MASTER_SERVICE_ACCOUNT} \ |
| 60 | + --service-account=${INSTALL_SERVICE_ACCOUNT} |
| 61 | +---- |
| 62 | +`<control_plane_deployment>` specifies the name of the control plane deployment. |
| 63 | + |
| 64 | +. Delete the temporary ignition file from the `05_control_plane` folder by running the following command: |
81 | 65 | + |
82 | 66 | [source,terminal] |
83 | 67 | ---- |
84 | | -$ gcloud deployment-manager deployments create ${INFRA_ID}-control-plane --config 05_control_plane.yaml |
| 68 | +$ rm 05_control_plane/master.ign |
85 | 69 | ---- |
86 | 70 |
|
87 | | -. The templates do not manage load balancer membership due to limitations of Deployment |
88 | | -Manager, so you must add the control plane machines manually. |
89 | | -** Run the following commands to add the control plane machines to the appropriate instance groups: |
| 71 | +. The templates do not manage load balancer membership due to limitations of Infrastructure Manager, so you must add the control plane machines manually. |
| 72 | + |
| 73 | +.. Add the first control plane machine to an internal load balancer instance group by running the following command: |
90 | 74 | + |
91 | 75 | [source,terminal] |
92 | 76 | ---- |
93 | 77 | $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_0}-ig --zone=${ZONE_0} --instances=${INFRA_ID}-master-0 |
94 | 78 | ---- |
| 79 | + |
| 80 | +.. Add the second control plane machine to an internal load balancer instance group by running the following command: |
95 | 81 | + |
96 | 82 | [source,terminal] |
97 | 83 | ---- |
98 | 84 | $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_1}-ig --zone=${ZONE_1} --instances=${INFRA_ID}-master-1 |
99 | 85 | ---- |
| 86 | + |
| 87 | +.. Add the third control plane machine to an internal load balancer instance group by running the following command: |
100 | 88 | + |
101 | 89 | [source,terminal] |
102 | 90 | ---- |
103 | 91 | $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_2}-ig --zone=${ZONE_2} --instances=${INFRA_ID}-master-2 |
104 | 92 | ---- |
105 | 93 |
|
106 | | -** For an external cluster, you must also run the following commands to add the control plane machines to the target pools: |
| 94 | +. For an external cluster, you must also add the control plane machines to external load balancer target pools. |
| 95 | + |
| 96 | +.. Add the first control plane machine to an external load balancer pool by running the following command: |
107 | 97 | + |
108 | 98 | [source,terminal] |
109 | 99 | ---- |
110 | 100 | $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-master-0 |
111 | 101 | ---- |
| 102 | + |
| 103 | +.. Add the first control plane machine to an external load balancer pool by running the following command: |
112 | 104 | + |
113 | 105 | [source,terminal] |
114 | 106 | ---- |
115 | 107 | $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-master-1 |
116 | 108 | ---- |
| 109 | + |
| 110 | +.. Add the first control plane machine to an external load balancer pool by running the following command: |
117 | 111 | + |
118 | 112 | [source,terminal] |
119 | 113 | ---- |
120 | 114 | $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-master-2 |
121 | | ----- |
122 | | -
|
123 | | -ifeval::["{context}" == "installing-gcp-user-infra-vpc"] |
124 | | -:!shared-vpc: |
125 | | -endif::[] |
| 115 | +---- |
0 commit comments