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

:_mod-docs-content-type: PROCEDURE
[id="hcp-virt-create-hc-ext-infra_{context}"]
= Creating a hosted cluster with the KubeVirt platform by using external infrastructure

[role="_abstract"]
By default, the HyperShift Operator hosts both the control plane pods of the hosted cluster and the KubeVirt worker VMs within the same cluster. With the external infrastructure feature, you can place the worker node VMs on a separate cluster from the control plane pods.

- The _management cluster_ is the {product-title} cluster that runs the HyperShift Operator and hosts the control plane pods for a hosted cluster.

- The _infrastructure cluster_ is the {product-title} cluster that runs the KubeVirt worker VMs for a hosted cluster.

- By default, the management cluster also acts as the infrastructure cluster that hosts VMs. However, for external infrastructure, the management and infrastructure clusters are different.

[IMPORTANT]
====
Avoid storing all hosted cluster information in a shared namespace. If you create a hosted cluster in a shared namespace and then back up and restore the hosted cluster, you might unintentionally change other hosted clusters. Either store hosted cluster information in a separate namespace or set up your hosted cluster to back up and restore resources based on labels.
====

.Prerequisites

* You must have a namespace on the external infrastructure cluster for the KubeVirt nodes to be hosted in.

* You must have a `kubeconfig` file for the external infrastructure cluster.

.Procedure

* In the `hcp` command-line interface, place the KubeVirt worker VMs on the infrastructure cluster, use the `--infra-kubeconfig-file` and `--infra-namespace` arguments, as shown in the following example:
+
[source,terminal]
----
$ hcp create cluster kubevirt \
  --name <hosted-cluster-name> \
  --node-pool-replicas <worker-count> \
  --pull-secret <path-to-pull-secret> \
  --memory <value-for-memory> \
  --cores <value-for-cpu> \
  --infra-namespace=<hosted-cluster-namespace>-<hosted-cluster-name> \
  --infra-kubeconfig-file=<path-to-external-infra-kubeconfig>
----
+
--
** `--name` defines the name of your hosted cluster, for example, `my-hosted-cluster`.
** `--node-pool-replicas` defines the worker count, for example, `2`.
** `--pull-secret` defines the path to your pull secret, for example, `/user/name/pullsecret`.
** `--memory` defines a value for memory, for example, `6Gi`.
** `--cores` defines a value for CPU, for example, `2`.
** `--infra-namespace` defines the infrastructure namespace, for example, `clusters-example`.
** `--infra-kubeconfig-file` defines the path to your `kubeconfig` file for the infrastructure cluster, for example, `/user/name/external-infra-kubeconfig`.
--
+
After you enter the command, the control plane pods are hosted on the management cluster that the HyperShift Operator runs on, and the KubeVirt VMs are hosted on a separate infrastructure cluster.