// Module included in the following assemblies:
//
// * hosted_control_planes/hcp-deploy/hcp-deploy-bm.adoc

:_mod-docs-content-type: PROCEDURE
[id="hcp-bm-hc-mirror_{context}"]
= Creating a hosted cluster on bare metal by using a mirror registry

[role="_abstract"]
You can use a mirror registry to create a hosted cluster on bare metal by specifying the `--image-content-sources` flag in the `hcp create cluster` command.

.Procedure

. Create a YAML file to define Image Content Source Policies (ICSP). See the following example:
+
[source,yaml]
----
- mirrors:
  - brew.registry.redhat.io
  source: registry.redhat.io
- mirrors:
  - brew.registry.redhat.io
  source: registry.stage.redhat.io
- mirrors:
  - brew.registry.redhat.io
  source: registry-proxy.engineering.redhat.com
----

. Save the file as `icsp.yaml`. This file contains your mirror registries.

. To create a hosted cluster by using your mirror registries, run the following command:
+
[source,terminal]
----
$ hcp create cluster agent \
    --name=<hosted_cluster_name> \
    --pull-secret=<path_to_pull_secret> \
    --agent-namespace=<hosted_control_plane_namespace> \
    --base-domain=<base_domain> \
    --api-server-address=api.<hosted_cluster_name>.<base_domain> \
    --image-content-sources <icsp.yaml>  \
    --ssh-key  <path_to_ssh_key> \
    --namespace <hosted_cluster_namespace> \
    --release-image=quay.io/openshift-release-dev/ocp-release:<ocp_release_image>
----
+
where:
+
`<hosted_cluster_name>`:: Specifies the name of your hosted cluster, for example, `my-hosted-cluster`.
`<path_to_pull_secret>`:: Specifies the path to your pull secret, for example, `/user/name/pullsecret`.
`<hosted_control_plane_namespace>`:: Specifies your hosted control plane namespace, for example, `clusters-example`. Ensure that agents are available in this namespace by using the `oc get agent -n <hosted-control-plane-namespace>` command.
`<base_domain>`:: Specifies your base domain, for example, `krnl.es`.
`<hosted_cluster_name>.<base_domain>`:: Specifies the IP address that is used for the Kubernetes API communication in the hosted cluster. If you do not set the `--api-server-address` flag, you must log in to connect to the management cluster.
`<icsp.yaml>`:: Specifies the `icsp.yaml` file that defines ICSP and your mirror registries.
`<path_to_ssh_key>`:: Specifies the path to your SSH public key. The default file path is `~/.ssh/id_rsa.pub`.
`<hosted_cluster_namespace>`:: Specifies your hosted cluster namespace.
`<ocp_release_image>`:: Specifies the supported {product-title} version that you want to use, for example, `4.22.0-multi`. If you are using a disconnected environment, replace `<ocp_release_image>` with the digest image. To extract the {product-title} release image digest, see "Extracting the {product-title} release image digest".