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

No need of "--restart=Never" flag to create a pod #197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

parth-pandit
Copy link
Contributor

No description provided.

@dgkanatsios
Copy link
Owner

thanks! Is --restart=Never deprecated? It's mentioned in the official kubectl docs https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands

@chirangaalwis
Copy link

chirangaalwis commented Oct 31, 2021

thanks! Is --restart=Never deprecated? It's mentioned in the official kubectl docs https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands

@dgkanatsios this is not deprecated but there is no real reason for using this and AFAIU that is what @parth-pandit is suggesting. In other words it is not mandatory.

+1 for this change.

@leonK-DI
Copy link

leonK-DI commented Feb 7, 2022

it is necessary if you want to run a temp pod, otherwise you are not going to get the logs, e.g.

kubectl run busybox --image=busybox --rm -it --restart=Never --labels=access=granted -- wget -O- http://nginx:80 --timeout 2`

But I am not sure why that is the case...

@pacozaa
Copy link
Contributor

pacozaa commented Oct 16, 2022

@leonK-DI
According to this doc https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run

Because --rm means your pod will be deleted(?) as soon as the command wget -O- http://nginx:80 --timeout 2 finishes

and as far as Kube is concerned it will keep your pod up all the time which means when the pod is terminated after finishing the wget command it will restart the pod again.

--restart=Never prevents the mentioned scenario from happening.

I know this might not be 100% correct because the document stated that --rm means delete the pod after it exits but I am not sure if in this case, it's equivalent to pod delete. (I suppose not if it's equivalent to pod delete it wouldn't be restarted again.)

@dgkanatsios Please confirm if my speculation is correct.

@pacozaa
Copy link
Contributor

pacozaa commented Oct 16, 2022

Also there is something similar here #167

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

Successfully merging this pull request may close these issues.

None yet

5 participants