mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
166 lines
5.5 KiB
Plaintext
166 lines
5.5 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * installing/installing_gcp/installing-gcp-user-infra.adoc
|
|
// * installing/installing_gcp/installing-restricted-networks-gcp.adoc
|
|
|
|
ifeval::["{context}" == "installing-gcp-user-infra-vpc"]
|
|
:shared-vpc:
|
|
endif::[]
|
|
|
|
[id="installation-creating-gcp-bootstrap_{context}"]
|
|
= Creating the bootstrap machine in GCP
|
|
|
|
You must create the bootstrap machine in Google Cloud Platform (GCP) to use during
|
|
{product-title} cluster initialization. One way to create this machine is
|
|
to modify the provided Deployment Manager template.
|
|
|
|
[NOTE]
|
|
====
|
|
If you do not use the provided Deployment Manager template to create your bootstrap
|
|
machine, 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
|
|
|
|
* Configure a GCP account.
|
|
* Generate the Ignition config files for your cluster.
|
|
* Create and configure a VPC and associated subnets in GCP.
|
|
* Create and configure networking and load balancers in GCP.
|
|
* Create control plane and compute roles.
|
|
|
|
.Procedure
|
|
|
|
. Copy the template from the *Deployment Manager template for the bootstrap machine*
|
|
section of this topic and save it as `04_bootstrap.py` on your computer. This
|
|
template describes the bootstrap machine that your cluster requires.
|
|
|
|
. Export the variables that the deployment template uses:
|
|
//You need these variables before you deploy the load balancers for the shared VPC case, so the export statements that are if'd out for shared-vpc are in the load balancer module.
|
|
.. Export the control plane subnet location:
|
|
+
|
|
ifndef::shared-vpc[]
|
|
[source,terminal]
|
|
----
|
|
$ export CONTROL_SUBNET=`gcloud compute networks subnets describe ${INFRA_ID}-master-subnet --region=${REGION} --format json | jq -r .selfLink`
|
|
----
|
|
endif::shared-vpc[]
|
|
|
|
.. Export the location of the {op-system-first} image that the installation program requires:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ export CLUSTER_IMAGE=`gcloud compute images describe ${INFRA_ID}-rhcos-image --format json | jq -r .selfLink`
|
|
----
|
|
|
|
ifndef::shared-vpc[]
|
|
.. Export the three zones that the cluster uses:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ export ZONE_0=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[0] | cut -d "/" -f9`
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ export ZONE_1=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[1] | cut -d "/" -f9`
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ export ZONE_2=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[2] | cut -d "/" -f9`
|
|
----
|
|
endif::shared-vpc[]
|
|
|
|
. Create a bucket and upload the `bootstrap.ign` file:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ gsutil mb gs://${INFRA_ID}-bootstrap-ignition
|
|
$ gsutil cp bootstrap.ign gs://${INFRA_ID}-bootstrap-ignition/
|
|
----
|
|
|
|
. Create a signed URL for the bootstrap instance to use to access the Ignition
|
|
config. Export the URL from the output as a variable:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ export BOOTSTRAP_IGN=`gsutil signurl -d 1h service-account-key.json \
|
|
gs://${INFRA_ID}-bootstrap-ignition/bootstrap.ign | grep "^gs:" | awk '{print $5}'`
|
|
----
|
|
|
|
. Create a `04_bootstrap.yaml` resource definition file:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ cat <<EOF >04_bootstrap.yaml
|
|
imports:
|
|
- path: 04_bootstrap.py
|
|
|
|
resources:
|
|
- name: cluster-bootstrap
|
|
type: 04_bootstrap.py
|
|
properties:
|
|
infra_id: '${INFRA_ID}' <1>
|
|
region: '${REGION}' <2>
|
|
zone: '${ZONE_0}' <3>
|
|
|
|
cluster_network: '${CLUSTER_NETWORK}' <4>
|
|
control_subnet: '${CONTROL_SUBNET}' <5>
|
|
image: '${CLUSTER_IMAGE}' <6>
|
|
machine_type: 'n1-standard-4' <7>
|
|
root_volume_size: '128' <8>
|
|
|
|
bootstrap_ign: '${BOOTSTRAP_IGN}' <9>
|
|
EOF
|
|
----
|
|
<1> `infra_id` is the `INFRA_ID` infrastructure name from the extraction step.
|
|
<2> `region` is the region to deploy the cluster into, for example `us-central1`.
|
|
<3> `zone` is the zone to deploy the bootstrap instance into, for example `us-central1-b`.
|
|
<4> `cluster_network` is the `selfLink` URL to the cluster network.
|
|
<5> `control_subnet` is the `selfLink` URL to the control subnet.
|
|
<6> `image` is the `selfLink` URL to the {op-system} image.
|
|
<7> `machine_type` is the machine type of the instance, for example `n1-standard-4`.
|
|
<8> `bootstrap_ign` is the URL output when creating a signed URL above.
|
|
|
|
. Create the deployment by using the `gcloud` CLI:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ gcloud deployment-manager deployments create ${INFRA_ID}-bootstrap --config 04_bootstrap.yaml
|
|
----
|
|
|
|
ifndef::shared-vpc[]
|
|
. The templates do not manage load balancer membership due to limitations of Deployment
|
|
Manager, so you must add the bootstrap machine manually:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ gcloud compute target-pools add-instances \
|
|
${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap
|
|
$ gcloud compute target-pools add-instances \
|
|
${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap
|
|
----
|
|
endif::shared-vpc[]
|
|
|
|
ifdef::shared-vpc[]
|
|
. Add the bootstrap instance to the internal load balancer instance group:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-bootstrap-instance-group --zone=${ZONE_0} --instances=${INFRA_ID}-bootstrap
|
|
----
|
|
|
|
. Add the bootstrap instance group to the internal load balancer backend service:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ gcloud compute backend-services add-backend ${INFRA_ID}-api-internal-backend-service --region=${REGION} --instance-group=${INFRA_ID}-bootstrap-instance-group --instance-group-zone=${ZONE_0}
|
|
----
|
|
endif::shared-vpc[]
|
|
|
|
ifeval::["{context}" == "installing-gcp-user-infra-vpc"]
|
|
:!shared-vpc:
|
|
endif::[]
|