1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/capi-creating-machine-template.adoc

89 lines
2.1 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_management/cluster_api_machine_management/cluster-api-configuration.adoc
:_mod-docs-content-type: PROCEDURE
[id="capi-creating-machine-template_{context}"]
= Creating a Cluster API machine template
You can create a provider-specific machine template resource by creating a YAML manifest file and applying it with the {oc-first}.
.Prerequisites
* You have deployed an {product-title} cluster.
* You have enabled the use of the Cluster API.
* You have access to the cluster using an account with `cluster-admin` permissions.
* You have installed the {oc-first}.
.Procedure
. Create a YAML file similar to the following. This procedure uses `<machine_template_resource_file>.yaml` as an example file name.
+
--
[source,yaml]
----
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: <machine_template_kind> # <1>
metadata:
name: <template_name> # <2>
namespace: openshift-cluster-api
spec:
template:
spec: # <3>
----
<1> Specify the machine template kind. This value must match the value for your platform.
The following values are valid:
+
|====
|Cluster infrastructure provider |Value
|{aws-first}
|`AWSMachineTemplate`
|{gcp-first}
|`GCPMachineTemplate`
|{azure-first}
|`AzureMachineTemplate`
|{rh-openstack-first}
|`OpenStackMachineTemplate`
|{vmw-first}
|`VSphereMachineTemplate`
|Bare metal
|`Metal3MachineTemplate`
|====
<2> Specify a name for the machine template.
<3> Specify the details for your environment. These parameters are provider specific. For more information, see the sample Cluster API machine template YAML for your provider.
--
. Create the machine template CR by running the following command:
+
[source,terminal]
----
$ oc create -f <machine_template_resource_file>.yaml
----
.Verification
* Confirm that the machine template CR is created by running the following command:
+
[source,terminal]
----
$ oc get <machine_template_kind> -n openshift-cluster-api
----
+
where `<machine_template_kind>` is the value that corresponds to your platform.
+
.Example output
[source,text]
----
NAME AGE
<template_name> 77m
----