Projects:Kubernetes: verschil tussen versies

Naar navigatie springen Naar zoeken springen
1.099 bytes toegevoegd ,  10 mrt 2019
Regel 164: Regel 164:
NAME  READY  STATUS    RESTARTS  AGE
NAME  READY  STATUS    RESTARTS  AGE
bash  1/1    Running  0          56s
bash  1/1    Running  0          56s
</pre>
Because of <code>--restart=Never</code>, if you exit your shell, the pod will exit and automatically be removed. If you don't give the parameter, kubectl will instead create a Deployment containing your Pod, instead of just the Pod; this means that when your Pod exits, the Deployment will have 0 out of 1 Pods running, so a new Pod will automatically be created:
<pre>
$ kubectl run -ti --image=ubuntu:bionic bash
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
If you don't see a command prompt, try pressing enter.
root@bash-58654c7f4b-9bhcq:/# touch foobarbaz
root@bash-58654c7f4b-9bhcq:/# exit
Session ended, resume using 'kubectl attach bash-58654c7f4b-9bhcq -c bash -i -t' command when the pod is running
[...wait for a bit until the pod comes back up...]
$ kubectl attach bash-58654c7f4b-9bhcq -c bash -i -t
If you don't see a command prompt, try pressing enter.
root@bash-58654c7f4b-9bhcq:/# ls foobarbaz
ls: cannot access 'foobarbaz': No such file or directory
</pre>
</pre>


Navigatiemenu