1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl  delete  -  Delete resources by filenames, stdin, resources and
7       names, or by resources and label selector
8
9
10

SYNOPSIS

12       kubectl delete [OPTIONS]
13
14
15

DESCRIPTION

17       Delete resources by  filenames,  stdin,  resources  and  names,  or  by
18       resources and label selector.
19
20
21       JSON  and YAML formats are accepted. Only one type of the arguments may
22       be specified: filenames, resources and names, or  resources  and  label
23       selector.
24
25
26       Some   resources,  such  as  pods,  support  graceful  deletion.  These
27       resources define a default period before they are  forcibly  terminated
28       (the   grace   period)  but  you  may  override  that  value  with  the
29       --grace-period flag, or pass --now to set a grace-period of 1.  Because
30       these  resources  often represent entities in the cluster, deletion may
31       not be acknowledged immediately. If the node hosting a pod is  down  or
32       cannot  reach the API server, termination may take significantly longer
33       than the grace period. To force delete a  resource,  you  must  pass  a
34       grace period of 0 and specify the --force flag.
35
36
37       IMPORTANT:  Force deleting pods does not wait for confirmation that the
38       pod's processes have been terminated, which can leave  those  processes
39       running  until  the  node  detects  the deletion and completes graceful
40       deletion. If your processes use shared storage or talk to a remote  API
41       and  depend on the name of the pod to identify themselves, force delet‐
42       ing those pods may result in multiple processes  running  on  different
43       machines  using  the same identification which may lead to data corrup‐
44       tion or inconsistency. Only force delete pods when you are sure the pod
45       is  terminated,  or if your application can tolerate multiple copies of
46       the same pod running at once. Also, if you force delete pods the sched‐
47       uler  may  place  new  pods on those nodes before the node has released
48       those resources and causing those pods to be evicted immediately.
49
50
51       Note that the delete command does NOT do resource version checks, so if
52       someone submits an update to a resource right when you submit a delete,
53       their update will be lost along with the rest of the resource.
54
55
56

OPTIONS

58       --all=false
59           Delete all resources, including uninitialized ones, in  the  names‐
60       pace of the specified resource types.
61
62
63       --cascade=true
64           If  true,  cascade  the  deletion  of the resources managed by this
65       resource (e.g. Pods created by a ReplicationController).  Default true.
66
67
68       --field-selector=""
69           Selector (field query)  to  filter  on,  supports  '=',  '==',  and
70       '!='.(e.g.  --field-selector  key1=value1,key2=value2). The server only
71       supports a limited number of field queries per type.
72
73
74       -f, --filename=[]
75           containing the resource to delete.
76
77
78       --force=false
79           Only  used  when  grace-period=0.  If  true,   immediately   remove
80       resources  from  API  and bypass graceful deletion. Note that immediate
81       deletion of some resources may result in inconsistency or data loss and
82       requires confirmation.
83
84
85       --grace-period=-1
86           Period of time in seconds given to the resource to terminate grace‐
87       fully. Ignored if negative. Set to 1 for immediate shutdown.  Can  only
88       be set to 0 when --force is true (force deletion).
89
90
91       --ignore-not-found=false
92           Treat  "resource  not  found"  as  a successful delete. Defaults to
93       "true" when --all is specified.
94
95
96       --include-uninitialized=false
97           If true, the kubectl command applies to uninitialized  objects.  If
98       explicitly  set to false, this flag overrides other flags that make the
99       kubectl commands apply to uninitialized objects, e.g., "--all". Objects
100       with empty metadata.initializers are regarded as initialized.
101
102
103       --now=false
104           If  true,  resources  are  signaled for immediate shutdown (same as
105       --grace-period=1).
106
107
108       -o, --output=""
109           Output mode. Use "-o name" for shorter output (resource/name).
110
111
112       -R, --recursive=false
113           Process the directory used in -f,  --filename  recursively.  Useful
114       when  you  want  to  manage related manifests organized within the same
115       directory.
116
117
118       -l, --selector=""
119           Selector (label query) to filter on,  not  including  uninitialized
120       ones.
121
122
123       --timeout=0s
124           The length of time to wait before giving up on a delete, zero means
125       determine a timeout from the size of the object
126
127
128       --wait=true
129           If true, wait for resources to be gone before returning. This waits
130       for finalizers.
131
132
133

OPTIONS INHERITED FROM PARENT COMMANDS

135       --alsologtostderr=false
136           log to standard error as well as files
137
138
139       --application-metrics-count-limit=100
140           Max number of application metrics to store (per container)
141
142
143       --as=""
144           Username to impersonate for the operation
145
146
147       --as-group=[]
148           Group  to  impersonate for the operation, this flag can be repeated
149       to specify multiple groups.
150
151
152       --azure-container-registry-config=""
153           Path to the file containing Azure container registry  configuration
154       information.
155
156
157       --boot-id-file="/proc/sys/kernel/random/boot_id"
158           Comma-separated  list  of files to check for boot-id. Use the first
159       one that exists.
160
161
162       --cache-dir="/builddir/.kube/http-cache"
163           Default HTTP cache directory
164
165
166       --certificate-authority=""
167           Path to a cert file for the certificate authority
168
169
170       --client-certificate=""
171           Path to a client certificate file for TLS
172
173
174       --client-key=""
175           Path to a client key file for TLS
176
177
178       --cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
179           CIDRs opened in GCE firewall for LB traffic proxy  health checks
180
181
182       --cluster=""
183           The name of the kubeconfig cluster to use
184
185
186       --container-hints="/etc/cadvisor/container_hints.json"
187           location of the container hints file
188
189
190       --containerd="unix:///var/run/containerd.sock"
191           containerd endpoint
192
193
194       --context=""
195           The name of the kubeconfig context to use
196
197
198       --default-not-ready-toleration-seconds=300
199           Indicates    the    tolerationSeconds   of   the   toleration   for
200       notReady:NoExecute that is added by default to every pod that does  not
201       already have such a toleration.
202
203
204       --default-unreachable-toleration-seconds=300
205           Indicates  the  tolerationSeconds  of  the  toleration for unreach‐
206       able:NoExecute that is added by default to  every  pod  that  does  not
207       already have such a toleration.
208
209
210       --docker="unix:///var/run/docker.sock"
211           docker endpoint
212
213
214       --docker-env-metadata-whitelist=""
215           a  comma-separated  list of environment variable keys that needs to
216       be collected for docker containers
217
218
219       --docker-only=false
220           Only report docker containers in addition to root stats
221
222
223       --docker-root="/var/lib/docker"
224           DEPRECATED: docker root is read from docker info (this is  a  fall‐
225       back, default: /var/lib/docker)
226
227
228       --docker-tls=false
229           use TLS to connect to docker
230
231
232       --docker-tls-ca="ca.pem"
233           path to trusted CA
234
235
236       --docker-tls-cert="cert.pem"
237           path to client certificate
238
239
240       --docker-tls-key="key.pem"
241           path to private key
242
243
244       --enable-load-reader=false
245           Whether to enable cpu load reader
246
247
248       --event-storage-age-limit="default=0"
249           Max length of time for which to store events (per type). Value is a
250       comma separated list of key values, where  the  keys  are  event  types
251       (e.g.: creation, oom) or "default" and the value is a duration. Default
252       is applied to all non-specified event types
253
254
255       --event-storage-event-limit="default=0"
256           Max number of events to store (per type). Value is  a  comma  sepa‐
257       rated  list  of  key values, where the keys are event types (e.g.: cre‐
258       ation, oom) or "default" and  the  value  is  an  integer.  Default  is
259       applied to all non-specified event types
260
261
262       --global-housekeeping-interval=1m0s
263           Interval between global housekeepings
264
265
266       --housekeeping-interval=10s
267           Interval between container housekeepings
268
269
270       --insecure-skip-tls-verify=false
271           If true, the server's certificate will not be checked for validity.
272       This will make your HTTPS connections insecure
273
274
275       --kubeconfig=""
276           Path to the kubeconfig file to use for CLI requests.
277
278
279       --log-backtrace-at=:0
280           when logging hits line file:N, emit a stack trace
281
282
283       --log-cadvisor-usage=false
284           Whether to log the usage of the cAdvisor container
285
286
287       --log-dir=""
288           If non-empty, write log files in this directory
289
290
291       --log-file=""
292           If non-empty, use this log file
293
294
295       --log-flush-frequency=5s
296           Maximum number of seconds between log flushes
297
298
299       --logtostderr=true
300           log to standard error instead of files
301
302
303       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
304           Comma-separated list of files to  check  for  machine-id.  Use  the
305       first one that exists.
306
307
308       --match-server-version=false
309           Require server version to match client version
310
311
312       --mesos-agent="127.0.0.1:5051"
313           Mesos agent address
314
315
316       --mesos-agent-timeout=10s
317           Mesos agent timeout
318
319
320       -n, --namespace=""
321           If present, the namespace scope for this CLI request
322
323
324       --password=""
325           Password for basic authentication to the API server
326
327
328       --profile="none"
329           Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
330       create|block|mutex)
331
332
333       --profile-output="profile.pprof"
334           Name of the file to write the profile to
335
336
337       --request-timeout="0"
338           The length of time to wait before giving  up  on  a  single  server
339       request. Non-zero values should contain a corresponding time unit (e.g.
340       1s, 2m, 3h). A value of zero means don't timeout requests.
341
342
343       -s, --server=""
344           The address and port of the Kubernetes API server
345
346
347       --skip-headers=false
348           If true, avoid header prefixes in the log messages
349
350
351       --stderrthreshold=2
352           logs at or above this threshold go to stderr
353
354
355       --storage-driver-buffer-duration=1m0s
356           Writes in the storage driver will be buffered  for  this  duration,
357       and committed to the non memory backends as a single transaction
358
359
360       --storage-driver-db="cadvisor"
361           database name
362
363
364       --storage-driver-host="localhost:8086"
365           database host:port
366
367
368       --storage-driver-password="root"
369           database password
370
371
372       --storage-driver-secure=false
373           use secure connection with database
374
375
376       --storage-driver-table="stats"
377           table name
378
379
380       --storage-driver-user="root"
381           database username
382
383
384       --token=""
385           Bearer token for authentication to the API server
386
387
388       --user=""
389           The name of the kubeconfig user to use
390
391
392       --username=""
393           Username for basic authentication to the API server
394
395
396       -v, --v=0
397           log level for V logs
398
399
400       --version=false
401           Print version information and quit
402
403
404       --vmodule=
405           comma-separated  list  of pattern=N settings for file-filtered log‐
406       ging
407
408
409

EXAMPLE

411                # Delete a pod using the type and name specified in pod.json.
412                kubectl delete -f ./pod.json
413
414                # Delete a pod based on the type and name in the JSON passed into stdin.
415                cat pod.json | kubectl delete -f -
416
417                # Delete pods and services with same names "baz" and "foo"
418                kubectl delete pod,service baz foo
419
420                # Delete pods and services with label name=myLabel.
421                kubectl delete pods,services -l name=myLabel
422
423                # Delete a pod with minimal delay
424                kubectl delete pod foo --now
425
426                # Force delete a pod on a dead node
427                kubectl delete pod foo --grace-period=0 --force
428
429                # Delete all pods
430                kubectl delete pods --all
431
432
433
434

SEE ALSO

436       kubectl(1),
437
438
439

HISTORY

441       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
442       com)  based  on the kubernetes source material, but hopefully they have
443       been automatically generated since!
444
445
446
447Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum