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

:_mod-docs-content-type: PROCEDURE
[id="hcp-ibm-z-infraenv_{context}"]
= Creating an InfraEnv resource for {hcp} on {ibm-z-title}

[role="_abstract"]
Before you can create a hosted cluster, you need an `InfraEnv` resource, which is the environment where hosts that are booted with PXE images can join as agents. In this case, the agents are created in the same namespace as your hosted control plane.

.Procedure

. Create a YAML file to contain the configuration. See the following example:
+
[source,yaml]
----
apiVersion: agent-install.openshift.io/v1beta1
kind: InfraEnv
metadata:
  name: <hosted_cluster_name>
  namespace: <hosted_control_plane_namespace>
spec:
  cpuArchitecture: s390x
  pullSecretRef:
    name: pull-secret
  sshAuthorizedKey: <ssh_public_key>
----

. Save the file as `infraenv-config.yaml`.

. Apply the configuration by entering the following command:
+
[source,terminal]
----
$ oc apply -f infraenv-config.yaml
----

. To fetch the URL to download the PXE or ISO images, such as, `initrd.img`, `kernel.img`, or `rootfs.img`, which allows {ibm-z-title} machines to join as agents, enter the following command:
+
[source,terminal]
----
$ oc -n <hosted_control_plane_namespace> get InfraEnv <hosted_cluster_name> -o json
----
