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-modifying-machine-template.adoc
2025-02-12 18:34:43 +00:00

77 lines
2.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_management/cluster_api_machine_management/cluster-api-managing-machines.adoc
:_mod-docs-content-type: PROCEDURE
[id="capi-modifying-machine-template_{context}"]
= Modifying a Cluster API machine template
You can update the machine template resource for your cluster by modifying the YAML manifest file and applying it with the {oc-first}.
.Prerequisites
* You have deployed an {product-title} cluster that uses the Cluster API.
* You have access to the cluster using an account with `cluster-admin` permissions.
* You have installed the {oc-first}.
.Procedure
. List the machine template resource for your cluster by running the following command:
+
--
[source,terminal]
----
$ oc get <machine_template_kind> <1>
----
<1> Specify the value that corresponds to your platform. The following values are valid:
* `AWSMachineTemplate`: The cluster is running on {aws-first}.
* `GCPMachineTemplate`: The cluster is running on {gcp-first}.
* `AzureMachineTemplate`: The cluster is running on {azure-first}.
* `VSphereMachineTemplate`: The cluster is running on {vmw-first}.
--
+
.Example output
[source,text]
----
NAME AGE
<template_name> 77m
----
. Write the machine template resource for your cluster to a file that you can edit by running the following command:
+
[source,terminal]
----
$ oc get <template_name> -o yaml > <template_name>.yaml
----
+
where `<template_name>` is the name of the machine template resource for your cluster.
. Make a copy of the `<template_name>.yaml` file with a different name. This procedure uses `<modified_template_name>.yaml` as an example file name.
. Use a text editor to make changes to the `<modified_template_name>.yaml` file that defines the updated machine template resource for your cluster.
When editing the machine template resource, observe the following:
** The parameters in the `spec` stanza are provider specific.
For more information, see the sample Cluster API machine template YAML for your provider.
** You must use a value for the `metadata.name` parameter that differs from any existing values.
+
[IMPORTANT]
====
For any Cluster API compute machine sets that reference this template, you must update the `spec.template.spec.infrastructureRef.name` parameter to match the `metadata.name` value in the new machine template resource.
====
. Apply the machine template CR by running the following command:
+
[source,terminal]
----
$ oc apply -f <modified_template_name>.yaml <1>
----
<1> Use the edited YAML file with a new name.
.Next steps
* For any Cluster API compute machine sets that reference this template, update the `spec.template.spec.infrastructureRef.name` parameter to match the `metadata.name` value in the new machine template resource.
For more information, see "Modifying a compute machine set by using the CLI."