May 2018
Intermediate to advanced
554 pages
13h 51m
English
Next, we are going to introduce the other update strategy, recreate, for Deployment. Although there is no subcommand or flag to create a recreate-strategy deployment, users could fulfill this creation by overriding the default element with the specified configuration:
// create a new Deployment, and override the update strategy.$ kubectl run recreate-nginx --image=nginx --port=80 --replicas=5 --overrides='{"apiVersion": "apps/v1", "spec": {"strategy": {"type": "Recreate"}}}'deployment.apps "recreate-nginx" created// verify our new Deployment$ kubectl describe deployment recreate-nginxName: recreate-nginxNamespace: defaultCreationTimestamp: Sat, 05 May 2018 18:17:07 -0400Labels: run=recreate-nginxAnnotations: ...