HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

kubectl replace — Replace a resource by file or `stdin`. More information: <https://kubernetes.io/docs/reference/kubec

Submitted by: @import:tldr-pages··
0
Viewed 0 times
resourcecommandclifilestdinmorereplacekubectl replace

Problem

How to use the kubectl replace command: Replace a resource by file or stdin. More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_replace/>.

Solution

kubectl replace — Replace a resource by file or stdin. More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_replace/>.

Replace the resource using the resource definition file:
kubectl replace {{[-f|--filename]}} {{path/to/file.yml}}


Replace the resource using the input passed into stdin:
kubectl replace {{[-f|--filename]}} -


Force replace, delete and then re-create the resource:
kubectl replace {{[-f|--filename]}} {{path/to/file.yml}} --force

Code Snippets

Replace the resource using the resource definition file

kubectl replace {{[-f|--filename]}} {{path/to/file.yml}}

Replace the resource using the input passed into `stdin`

kubectl replace {{[-f|--filename]}} -

Force replace, delete and then re-create the resource

kubectl replace {{[-f|--filename]}} {{path/to/file.yml}} --force

Context

tldr-pages: common/kubectl replace

Revisions (0)

No revisions yet.