github.com/openshift/installer@v1.4.17/docs/user/metal/install_upi.md (about)

     1  # Install: BareMetal User Provided Infrastructure
     2  
     3  The upstream project that provides management of bare metal hosts is [metal.equinix.com][equinix-metal].
     4  
     5  The steps for performing a UPI-based install are maintained in the official [openshift docs][openshift-upi-metal].
     6  
     7  ## Table of contents
     8  
     9  1. Minimum compute requirements
    10  
    11  2. Network topology requirements
    12  
    13  3. DNS requirements
    14  
    15  4. Getting Ignition configs for machines
    16  
    17  5. Getting OS related assets for machines
    18  
    19  6. Booting machines with RHCOS and Ignition configs
    20  
    21  7. Watching your installation (bootstrap_complete, cluster available)
    22  
    23  8. Example Bare-Metal UPI deployment
    24  
    25  ## Compute
    26  
    27  The smallest OpenShift 4.x clusters require the following host:
    28  
    29  * 1 bootstrap machine.
    30  
    31  * 3 control plane machines.
    32  
    33  * at least 1 worker machine.
    34  
    35  NOTE: The cluster requires the bootstrap machine to deploy the OpenShift cluster on to the 3 control plane machines, and you can remove the bootstrap machine.
    36  
    37  The bootstrap and control plane machines must use Red Hat Enterprise Linux CoreOS (RHCOS) as the operating system.
    38  
    39  ### Minimum resource requirements
    40  
    41  Processing
    42  Memory
    43  Storage
    44  Networking
    45  
    46  [todo-link-to-minimum-resource-requirements]
    47  
    48  ## Network Topology Requirements
    49  
    50  OpenShift 4.x requires all nodes to have internet access to pull images for platform containers and provide telemetry data to Red Hat.
    51  
    52  ### Load balancers
    53  
    54  Before you install OpenShift, you must provision two load balancers.
    55  
    56  * A load balancer for the control plane and bootstrap machines that targets port 6443 (Kubernetes APIServer) and 22623([Machine Config server][machine-config-server]). Port 6443 must be accessible to both clients external to the cluster and nodes within the cluster, and port 22623 must be accessible to nodes within the cluster.
    57  
    58    NOTE: Bootstrap machine can be deleted as target after cluster installation is finished.
    59  
    60  * A load balancer for the machines that run the [ingress router][openshift-router] pods that balances ports 443 and 80. Both the ports must be accessible to both clients external to the cluster and nodes within the cluster.
    61  
    62      NOTE: A working configuration for the ingress router is required for an OpenShift 4.x cluster.
    63  
    64      NOTE: The default configuration for Cluster Ingress Operator  deploys the ingress router to `worker` nodes in the cluster. The administrator needs to configure the [ingress][openshift-router] after the control plane has been bootstrapped.
    65  
    66  ### Connectivity between machines
    67  
    68  You must configure the network connectivity between machines to allow cluster components to communicate.
    69  
    70  * Etcd
    71  
    72      As the etcd members are located on the control plane machines. Each control plane machine requires connectivity to [etcd server][etcd-ports], [etcd peer][etcd-ports] and [etcd-metrics][etcd-ports] on every other control plane machine.
    73  
    74  * OpenShift SDN
    75  
    76      All the machines require connectivity to certain reserved ports on every other machine to establish in-cluster networking. For more details refer [doc][sdn-ports].
    77  
    78  * Kubernetes NodePort
    79  
    80      All the machines require connectivity to Kubernetes NodePort range 30000-32767 on every other machine for OpenShift platform components.
    81  
    82  * OpenShift reserved
    83  
    84      All the machines require connectivity to reserved port ranges 10250-12252 and 9000-9999 on every other machine for OpenShift platform components.
    85  
    86  ### Connectivity during machine boot
    87  
    88  All the RHCOS machines require network in `initramfs` during boot to fetch Ignition config from the Machine Config Server [machine-config-server].
    89  
    90  ## DNS requirements
    91  
    92  * Kubernetes API
    93  
    94      OpenShift 4.x requires the DNS records `api.$cluster_name.$base_domain` and `api-int.$cluster_name.$base_domain` to point to the Load balancer targeting the control plane machines. Both records must be resolvable from all the nodes within the cluster. The `api.$cluster_name.$base_domain` must also be resolvable by clients external to the cluster.
    95  
    96  * etcd
    97  
    98      For each control plane machine, OpenShift 4.x requires DNS records `etcd-$idx.$cluster_name.$base_domain` to point to `$idx`'th control plane machine. The DNS record must resolve to an unicast IPV4 address for the control plane machine and the records must be resolvable from all the nodes in the cluster.
    99  
   100      For each control plane machine, OpenShift 4.x also requires a SRV DNS record for etcd server on that machine with priority `0`, weight `10` and port `2380`. For 3 control plane cluster, the records look like:
   101  
   102      ```plain
   103      # _service._proto.name.                            TTL   class SRV priority weight port target.
   104      _etcd-server-ssl._tcp.$cluster_name.$base_domain   86400 IN    SRV 0        10     2380 etcd-0.$cluster_name.$base_domain.
   105      _etcd-server-ssl._tcp.$cluster_name.$base_domain   86400 IN    SRV 0        10     2380 etcd-1.$cluster_name.$base_domain.
   106      _etcd-server-ssl._tcp.$cluster_name.$base_domain   86400 IN    SRV 0        10     2380 etcd-2.$cluster_name.$base_domain.
   107      ```
   108  
   109  * OpenShift Routes
   110  
   111      OpenShift 4.x requires the DNS record `*.apps.$cluster_name.$base_domain` to point to the Load balancer targeting the machines running the ingress router pods. This record must be resolvable by both clients external to the cluster and from all the nodes within the cluster.
   112  
   113  ## Getting ignition configs for machines
   114  
   115  The OpenShift Installer provides administrators various assets that are required to create an OpenShift cluster, namely:
   116  
   117  * Ignition configs: The OpenShift Installer provides Ignition configs that should be used to configure the RHCOS based bootstrap and control plane machines using `bootstrap.ign`  and `master.ign` respectively. The OpenShift Installer also provides `worker.ign` that can be used to configure the RHCOS based `worker` machines, but also can be used as source for configuring RHEL based machines [todo-link-to-BYO-RHEL].
   118  
   119  * Admin Kubeconfig: The OpenShift Installer provides a kubeconfig with admin level privileges to Kubernetes APIServer.
   120  
   121      NOTE: This kubeconfig is configured to use `api.$cluster_name.$base_domain` DNS name to communicate with the Kubernetes APIServer.
   122  
   123  ### Setting up install-config for installer
   124  
   125  The OpenShift installer uses an [Install Config](../customization.md#platform-customization) to drive all install time configuration. Note that, the Openshift Installer currently can not create the Install Config for baremetal and you will have to manually create this file.
   126  
   127  An example install config for bare-metal UPI is as follows:
   128  
   129  ```yaml
   130  apiVersion: v1
   131  ## The base domain of the cluster. All DNS records will be sub-domains of this base and will also include the cluster name.
   132  baseDomain: example.com
   133  compute:
   134  - name: worker
   135    replicas: 1
   136  controlPlane:
   137    name: master
   138    replicas: 1
   139  metadata:
   140    ## The name for the cluster
   141    name: test
   142  platform:
   143    none: {}
   144  ## The pull secret that provides components in the cluster access to images for OpenShift components.
   145  pullSecret: ''
   146  ## The default SSH key that will be programmed for `core` user.
   147  sshKey: ''
   148  ```
   149  
   150  Create a directory that will be used by the OpenShift installer to provide all the assets. For example `test-bare-metal`,
   151  
   152  ```console
   153  $ mkdir test-bare-metal
   154  $ tree test-bare-metal
   155  test-bare-metal
   156  
   157  0 directories, 0 files
   158  ```
   159  
   160  Copy *your* `install-config` to the `INSTALL_DIR`. For example using the `test-bare-metal` as our `INSTALL_DIR`,
   161  
   162  ```console
   163  $ cp <your-instal-config> test-bare-metal/install-config.yaml
   164  $ tree test-bare-metal
   165  test-bare-metal
   166  └── install-config.yaml
   167  
   168  0 directories, 1 file
   169  ```
   170  
   171  NOTE: The filename for `install-config` in the `INSTALL_DIR` must be `install-config.yaml`
   172  
   173  ### Invoking the installer to get Ignition configs
   174  
   175  Given that you have setup the `INSTALL_DIR` with the appropriate `install-config`, you can create the Ignition configs by using the `create ignition-configs` target. For example,
   176  
   177  ```console
   178  $ openshift-install --dir test-bare-metal create ignition-configs
   179  INFO Consuming "Install Config" from target directory
   180  $ tree test-bare-metal
   181  test-bare-metal
   182  ├── auth
   183  │   └── kubeconfig
   184  ├── bootstrap.ign
   185  ├── master.ign
   186  └── worker.ign
   187  
   188  1 directory, 4 files
   189  ```
   190  
   191  ## Getting OS related assets for machines
   192  
   193  TODO RHEL CoreOS does not have assets for bare-metal.
   194  
   195  ## Booting machines with RHCOS and Ignition configs
   196  
   197  ### Required kernel parameters during PXE
   198  
   199  * `rd.neednet=1`: [CoreOS Installer][coreos-installer] needs internet access to fetch the OS image that needs to be installed on the machine.
   200  
   201  * `coreos.inst.image_url`: Required for versions <= 4.5 only; should be the URL to a CoreOS "metal" image.  In 4.6+ the metal image is included in the Live images.
   202  
   203  * CoreOS Installer [arguments][coreos-installer-args] are required to be configured to install RHCOS and setup the Ignition config file for that machine.
   204  
   205  ## Watching your installation
   206  
   207  ### Monitor for bootstrap-complete
   208  
   209  The administrators can use the `wait-for bootstrap-complete` target of the OpenShift Installer to monitor cluster bootstrapping. The command succeeds when it notices `bootstrap-complete` event from Kubernetes APIServer. This event is generated by the bootstrap machine after the Kubernetes APIServer has been bootstrapped on the control plane machines. For example,
   210  
   211  ```console
   212  $ openshift-install --dir test-bare-metal wait-for bootstrap-complete
   213  INFO Waiting up to 30m0s for the Kubernetes API at https://api.test.example.com:6443...
   214  INFO API v1.12.4+c53f462 up
   215  INFO Waiting up to 30m0s for the bootstrap-complete event...
   216  ```
   217  
   218  ## Monitor for cluster completion
   219  
   220  The administrators can use the `wait-for install-complete` target of the OpenShift Installer to monitor cluster completion. The command succeeds when it notices that Cluster Version Operator has completed rolling out the OpenShift cluster from Kubernetes APIServer.
   221  
   222  ```console
   223  $ openshift-install wait-for install-complete
   224  INFO Waiting up to 30m0s for the cluster to initialize...
   225  ```
   226  
   227  ## Example Bare-Metal UPI deployment
   228  
   229  ### Overview
   230  
   231  * Compute: Uses [Equinix Metal][equinix-metal] to deploy bare-metal machines.
   232      Uses [matchbox] to serve PXE scripts and Ignition configs for bootstrap, control plane and worker machines.
   233      Uses `public` IPv4 addresses for each machine, so that all the machines are accessible on the internet.
   234  
   235  * DNS and Load Balancing
   236      Uses AWS [Route53](aws-route53) to configure the all the DNS records.
   237      Uses Round-Robin DNS [RRDNS][rrdns] in place of load balancing solutions.
   238  
   239  Refer to the pre-requisites for UPI bare-metal installations [here][upi-metal-prereqs].
   240  
   241  ### Creating the cluster
   242  
   243  #### Installer assets
   244  
   245  Use the OpenShift Installer to create [Ignition configs](#getting-ignition-configs-for-machines) that will be used to create bootstrap, control plane and worker machines.
   246  
   247  #### Creating resources
   248  
   249  Initialize terraform to download all the required providers. For more info on terraform [init][terraform-init] and terraform [providers][terraform-providers]
   250  
   251  ```sh
   252  terraform init
   253  ```
   254  
   255  Create all the resources using terraform by invoking [apply][terraform-apply]
   256  
   257  ```sh
   258  terraform apply -auto-approve
   259  ```
   260  
   261  #### Monitoring bootstrap-complete and removing bootstrap resources
   262  
   263  Use the bootstrap [monitoring](#monitor-for-bootstrap-complete) to track when cluster bootstrapping has finished. After the Kubernetes APIServer has been bootstrapped on the control plane machines, the bootstrap machine can be removed from the API pool by following:
   264  
   265  ```sh
   266  terraform apply -auto-approve -var=bootstrap_dns="false"
   267  ```
   268  
   269  NOTE: The bootstrap resources like the bootstrap machines currently cannot be removed using terraform. You can use the [Equinix Metal console][equinix-metal-console] to remove the bootstrap machine. All the resources will be cleaned up by `terraform destroy`
   270  
   271  ### Approving server certificates for nodes
   272  
   273  To allow Kube APIServer to communicate with the kubelet running on nodes for logs, rsh etc. The administrator needs to approve the CSR [requests][csr-requests] generated by each kubelet.
   274  
   275  You can approve all `Pending` CSR requests using,
   276  
   277  ```sh
   278  oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve
   279  ```
   280  
   281  ### Updating image-registry to emptyDir storage backend
   282  
   283  The Cluster Image Registry [Operator][cluster-image-registry-operator] does not pick an storage backend for `None` platform. Therefore, the cluster operator is will be stuck in progressing because it is waiting for administrator to [configure][cluster-image-registry-operator-configuration] a storage backend for the image-registry. You can pick `emptyDir` for non-production clusters by following:
   284  
   285  ```sh
   286  oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
   287  ```
   288  
   289  #### Monitoring cluster completion
   290  
   291  Use the cluster finish [monitoring](#monitor-for-cluster-completion) to track when cluster has completely finished deploying.
   292  
   293  #### Destroying the cluster
   294  
   295  Use terraform [destroy][terraform-destroy] to destroy all the resources for the cluster. For example,
   296  
   297  ```console
   298  terraform destroy -auto-approve
   299  ```
   300  
   301  [aws-route53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
   302  [cluster-image-registry-operator-configuration]: https://github.com/openshift/cluster-image-registry-operator#registry-resource
   303  [cluster-image-registry-operator]: https://github.com/openshift/cluster-image-registry-operator#image-registry-operator
   304  [coreos-installer-args]: https://github.com/coreos/coreos-installer#kernel-command-line-options-for-coreos-installer-running-in-the-initramfs
   305  [coreos-installer]: https://github.com/coreos/coreos-installer#coreos-installer
   306  [csr-requests]: https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/#requesting-a-certificate
   307  [equinix-metal]: https://metal.equinix.com
   308  [equinix-metal-console]: https://console.equinix.com
   309  [etcd-ports]: https://github.com/openshift/origin/pull/21520
   310  [machine-config-server]: https://github.com/openshift/machine-config-operator/blob/master/docs/MachineConfigServer.md
   311  [matchbox]: https://github.com/coreos/matchbox
   312  [openshift-router]: https://github.com/openshift/cluster-ingress-operator#openshift-ingress-operator
   313  [rrdns]: https://tools.ietf.org/html/rfc1794
   314  [sdn-ports]: https://github.com/openshift/origin/pull/21520
   315  [terraform-apply]: https://www.terraform.io/docs/commands/apply.html
   316  [terraform-destroy]: https://www.terraform.io/docs/commands/destroy.html
   317  [terraform-init]: https://www.terraform.io/docs/commands/init.html
   318  [terraform-providers]: https://www.terraform.io/docs/providers/
   319  [upi-metal-example-pre-req]: ../../../upi/metal/README.md#pre-requisites
   320  [upi-metal-example-tfvar]: ../../../upi/metal/terraform.tfvars.example
   321  [upi-metal-example]: ../../../upi/metal/README.md
   322  [openshift-upi-metal]: https://docs.openshift.com/container-platform/latest/installing/installing_bare_metal/installing-bare-metal.html
   323  [upi-metal-prereqs]: https://docs.openshift.com/container-platform/latest/installing/installing_bare_metal/installing-bare-metal.html#prerequisites