Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"--restart=Never" Still needed? #157

Open
tech2blog opened this issue Nov 29, 2020 · 5 comments
Open

"--restart=Never" Still needed? #157

tech2blog opened this issue Nov 29, 2020 · 5 comments

Comments

@tech2blog
Copy link

I don't think we need --restart=Never option anymore with the latest K8s version as no deployment is created when we run

kubectl run nginx --image=nginx

k8s@k8s-m:~$ kubectl run nginx --image=nginx
pod/nginx created
k8s@k8s-m:~$ kubectl get po
NAME    READY   STATUS    RESTARTS   AGE
nginx   1/1     Running   0          4s
k8s@k8s-m:~$
k8s@k8s-m:~$ kubectl get deployments.apps
No resources found in default namespace.
@nicoclau
Copy link

nicoclau commented Dec 3, 2020

It was necessary for k8s lower than 1.18, not anymore. kubectl run only creates pods.
For deployment do kubectl create deployment.

@shubhamrajvanshi
Copy link
Contributor

Well while this is true but having restart=Never comes in handy when you are working with pods that have images like busybox, alpine etc.

@srikanthsrs
Copy link

@shubhamrajvanshi Can you expand this? Why does it come in handy when working with busybox or alpine?

@janekmichalik
Copy link

janekmichalik commented Apr 27, 2021

@srikanthsrs because mentioned images without i.e. sleep infinity command will exit with 0 exit code (container exits) and then will be restarted. Nginx image has infinity process running inside so it wont exit - wont be restarted (container is running)

@netserf
Copy link

netserf commented Apr 29, 2021

If --restart=Never is only relevant to busybox and alpine pods, then shouldn't this option be removed in examples using other images such as nginx? This should help clarify usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants