bureaucraten, interfacemoderatoren, Beheerders (Semantic MediaWiki), Curatoren (Semantic MediaWiki), Redacteuren (Semantic MediaWiki), toezichthouders, beheerders
205
bewerkingen
Regel 167: | Regel 167: | ||
</pre> | </pre> | ||
In the command above, we gave <code>--restart=Never</code>. There are three parameters to this option: | |||
* <code>Never</code>: When the pod exits, it will not be recreated. If this is given, <code>kubectl</code> will just create a Pod. | |||
* <code>OnFailure</code>: When the pod exits with failure, it will be recreated, otherwise not. In other words, <code>kubectl</code> will start a Job to create the Pod. (If that doesn't make sense, quickly check up on Jobs in the Concepts section above!) | |||
* <code>Always</code>: When the pod exits, it will be recreated. You guessed it: in this case, <code>kubectl</code> will create a Deployment. (If you didn't guess it, re-check the Concepts section!) | |||
The default is <code>--restart=Always</code> so you'll see the container is recreated like this: | |||
<pre> | <pre> | ||
$ kubectl run -ti --image=ubuntu:bionic bash | $ kubectl run -ti --image=ubuntu:bionic bash | ||
If you don't see a command prompt, try pressing enter. | If you don't see a command prompt, try pressing enter. | ||
root@bash-58654c7f4b-9bhcq:/# touch foobarbaz | root@bash-58654c7f4b-9bhcq:/# touch foobarbaz | ||
Regel 186: | Regel 191: | ||
As you can see, the container restarted, as <code>/foobarbaz</code> did not exist anymore when re-attaching after the <code>exit</code>. Any state in the filesystem of the container/pod will be gone upon restart. | As you can see, the container restarted, as <code>/foobarbaz</code> did not exist anymore when re-attaching after the <code>exit</code>. Any state in the filesystem of the container/pod will be gone upon restart. | ||
If you tried this, you can check and remove the deployment like this: | |||
<pre> | |||
$ kubectl get deployments | |||
NAME READY UP-TO-DATE AVAILABLE AGE | |||
bash 1/1 1 1 3s | |||
$ kubectl delete deployment bash | |||
deployment.extensions "bash" deleted | |||
</pre> | |||
== Storage using Volumes == | == Storage using Volumes == |