kubectl-replace
Replace a resource by filename or stdin
TLDR
Replace resource from file
$ kubectl replace -f [manifest.yaml]
Force replace (delete and recreate)$ kubectl replace --force -f [manifest.yaml]
Replace from stdin$ cat [manifest.yaml] | kubectl replace -f -
Dry run without applying changes$ kubectl replace -f [manifest.yaml] --dry-run=client
Replace and process a kustomization directory$ kubectl replace -k [directory/]
Replace resources from multiple files$ kubectl replace -f [file1.yaml] -f [file2.yaml]
SYNOPSIS
kubectl replace -f FILENAME [options]
DESCRIPTION
kubectl replace replaces a resource by filename or stdin. JSON and YAML formats are accepted. The resource must already exist. Unlike apply, replace requires the complete resource specification, which can be obtained with `kubectl get TYPE NAME -o yaml`. Use --force to delete and recreate the resource.
PARAMETERS
-f, --filename file
Filename, directory, or URL to file to use to replace the resource.-k, --kustomize dir
Process a kustomization directory. Cannot be used with -f or -R.-R, --recursive
Process the directory used in -f recursively.--force
If true, immediately remove resources from API and bypass graceful deletion.--cascade mode
Cascade deletion strategy for dependents: "background", "orphan", or "foreground". Default: "background".--grace-period seconds
Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Default: -1.--dry-run strategy
Must be "none", "server", or "client". Default: "none".--validate mode
Validation mode: "strict", "warn", or "ignore". Default: "strict".-o, --output format
Output format: json, yaml, name, go-template, jsonpath, etc.--save-config
Save the configuration of the current object in its annotation for future use with kubectl apply.--field-manager name
Name of the manager used to track field ownership. Default: "kubectl-replace".--subresource name
If specified, replace will operate on the subresource of the requested object.--timeout duration
Length of time to wait before giving up on a delete.--wait
If true, wait for resources to be gone before returning.--raw URI
Raw URI to PUT to the server.
SEE ALSO
kubectl(1), kubectl-apply(1), kubectl-create(1), kubectl-delete(1), kubectl-edit(1), kubectl-patch(1)
