JSON 6902 Patches
Inline Definition in kustomization.yaml
Below is an example of an inline patch applied to the “api-deployment”:Referencing an External Patch File
Alternatively, you can reference a separate file. In this example, the external file (replica-patch.yaml) is used for the “nginx-deployment”:
replica-patch.yaml), the patch is defined as follows:
Strategic Merge Patches
For strategic merge patches, you can similarly choose between inline definitions or referencing an external file.Inline Strategic Merge Patch in kustomization.yaml
The following example shows an inline strategic merge patch for the “api-deployment”:Using an External YAML File for Strategic Merge Patch
To reference a file for a strategic merge patch, simply include the file path in your kustomization.yaml:Both inline definitions and separate patch files are valid options. Choose the approach that best suits your project structure and maintenance preferences.
Summary Table
| Patch Type | Inline Example | External File Example |
|---|---|---|
| JSON 6902 Patch | Inline definition in kustomization.yaml as shown above | Reference external file (replica-patch.yaml) |
| Strategic Merge Patch | Inline definition in kustomization.yaml as shown above | Reference external file (replica-patch.yaml) |