// Force update, delete and then re-create the resource
kubectl update --force -f pod.json
```
```
### Options
### Options
```
```
--cascade=false: Only relevant during a force update. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.
-f, --filename=[]: Filename, directory, or URL to file to use to update the resource.
-f, --filename=[]: Filename, directory, or URL to file to use to update the resource.
--force=false: Delete and re-create the specified resource
--grace-period=-1: Only relevant during a force update. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.
-h, --help=false: help for update
-h, --help=false: help for update
--patch="": A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.
--patch="": A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.
--timeout=0: Only relevant during a force update. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object
@@ -21,10 +21,22 @@ JSON and YAML formats are accepted.
...
@@ -21,10 +21,22 @@ JSON and YAML formats are accepted.
.SH OPTIONS
.SH OPTIONS
.PP
.PP
\fB\-\-cascade\fP=false
Only relevant during a force update. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.
.PP
\fB\-f\fP, \fB\-\-filename\fP=[]
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to file to use to update the resource.
Filename, directory, or URL to file to use to update the resource.
.PP
.PP
\fB\-\-force\fP=false
Delete and re\-create the specified resource
.PP
\fB\-\-grace\-period\fP=\-1
Only relevant during a force update. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.
.PP
\fB\-h\fP, \fB\-\-help\fP=false
\fB\-h\fP, \fB\-\-help\fP=false
help for update
help for update
...
@@ -32,6 +44,10 @@ JSON and YAML formats are accepted.
...
@@ -32,6 +44,10 @@ JSON and YAML formats are accepted.
\fB\-\-patch\fP=""
\fB\-\-patch\fP=""
A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.
A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.
.PP
\fB\-\-timeout\fP=0
Only relevant during a force update. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object
cmd.Flags().StringP("selector","l","","Selector (label query) to filter on.")
cmd.Flags().StringP("selector","l","","Selector (label query) to filter on.")
cmd.Flags().Bool("all",false,"[-all] to select all the specified resources.")
cmd.Flags().Bool("all",false,"[-all] to select all the specified resources.")
cmd.Flags().Bool("ignore-not-found",false,"Treat \"resource not found\" as a successful delete.")
cmd.Flags().Bool("ignore-not-found",false,"Treat \"resource not found\" as a successful delete.")
cmd.Flags().Bool("cascade",true,"If true, cascade the delete resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.")
cmd.Flags().Bool("cascade",true,"If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.")
cmd.Flags().Int("grace-period",-1,"Period of time in seconds given to the resource to terminate gracefully. Ignored if negative.")
cmd.Flags().Int("grace-period",-1,"Period of time in seconds given to the resource to terminate gracefully. Ignored if negative.")
cmd.Flags().Duration("timeout",0,"The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object")
cmd.Flags().Duration("timeout",0,"The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object")
cmd.Flags().String("patch","","A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.")
cmd.Flags().String("patch","","A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated.")
cmd.MarkFlagRequired("patch")
cmd.MarkFlagRequired("patch")
cmd.Flags().Bool("force",false,"Delete and re-create the specified resource")
cmd.Flags().Bool("cascade",false,"Only relevant during a force update. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.")
cmd.Flags().Int("grace-period",-1,"Only relevant during a force update. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.")
cmd.Flags().Duration("timeout",0,"Only relevant during a force update. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object")
//Update will create a resource if it doesn't exist already, so ignore not found error
ignoreNotFound:=true
// By default use a reaper to delete all related resources.
ifcmdutil.GetFlagBool(cmd,"cascade"){
glog.Warningf("\"cascade\" is set, kubectl will delete and re-create all resources managed by this resource (e.g. Pods created by a ReplicationController). Consider using \"kubectl rolling-update\" if you want to update a ReplicationController together with its Pods.")