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

Cannot create pod with the same name as a pod that has already finished #22986

Closed
piosz opened this issue Mar 15, 2016 · 10 comments
Closed

Cannot create pod with the same name as a pod that has already finished #22986

piosz opened this issue Mar 15, 2016 · 10 comments
Labels
area/kubectl kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@piosz
Copy link
Member

piosz commented Mar 15, 2016

I created pod with the following command:

kubectl run load-generator --image=busybox --restart=Never

The pod has finished successfully. The pod is not displayed in pod list, although when I try to run a pod with the same name I've got an error:

Error from server: pods "load-generator" already exists

@bgrant0607 not sure if this works as intended. If yes it's at least very confusing.

cc @fgrzadkowski @gmarek

@piosz piosz added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. team/ux labels Mar 15, 2016
@adohe-zz
Copy link

/cc

@bgrant0607
Copy link
Member

@piosz Finished != deleted. WAI

Do kubectl get pods --show-all

@bgrant0607
Copy link
Member

We intentionally don't delete pods when they finish so people can see what status they finished with.

@bgrant0607 bgrant0607 added priority/backlog Higher priority than priority/awaiting-more-evidence. kind/documentation Categorizes issue or PR as related to documentation. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Mar 15, 2016
@bgrant0607
Copy link
Member

We should definitely document this behavior, though.

@fgrzadkowski
Copy link
Contributor

Maybe it'd help if we print some warning that the existing pod which we conflict with is in state finished? We can also print a warning in kubectl get pods that some pods may have been omitted and you need to run --show-all to print everything. WDYT? @bgrant0607

@bgrant0607
Copy link
Member

Good idea @fgrzadkowski

@adohe-zz
Copy link

also SGTM.

@vefimova
Copy link
Contributor

Hi guys, as it's not possible to assign issue to myself, just posting comment here, that I'm going to prepare patch for it, to not be working on the same isuue with somebody else.
BTW, is there another method to annonce that you started to work on the issue?

@janetkuo
Copy link
Member

@vefimova thanks!

@idvoretskyi
Copy link
Member

@vefimova just let us know here in the thread. Usually, that's enough.

If someone would like to work on this issue as well, I hope, they will reach you in the thread.

vefimova added a commit to vefimova/kubernetes that referenced this issue Jun 16, 2016
…tl create/run` in case of conflict with terminated pods/jobs

    Fixes kubernetes#22986

    - added printing clarification on pod or job creation AlreadyExists error
      in case of the failure is due to conflicting with pod/job in terminated state
    - added warning description regarding terminated pods to `get` long help message
    - added printing of warning message in case of `get pods`
vefimova added a commit to vefimova/kubernetes that referenced this issue Aug 5, 2016
  - added warning description regarding terminated pods to `get` long help message
  - added printing of warning message in case of `get pods` if there are hidden pods
Fixes kubernetes#22986
vefimova added a commit to vefimova/kubernetes that referenced this issue Aug 15, 2016
  - added warning description regarding terminated objects to `get` long help message
  - added printing of warning message in case of `get pods` if there are hidden pods
Fixes kubernetes#22986
k8s-github-robot pushed a commit that referenced this issue Aug 17, 2016
Automatic merge from submit-queue

Added warning msg for `kubectl get`

- added warning description regarding terminated pods to `get` long help message
  - added printing of warning message in case of `get pods` if there are hidden pods

Fixes #22986  (initiall PR and discussion are here #26417)

## **Output examples:**
### # kubectl get pods
```
NAME                       READY     STATUS             RESTARTS   AGE
dapi-test-pod1             0/1       Terminating        0          22h
liveness-http              0/1       CrashLoopBackOff   11245      22d
ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2336       8d
  info: 1 completed object(s) was(were) not shown in pods list. Pass --show-all to see all objects.

```

### #  kubectl get pods,namespaces
```
NAME                          READY     STATUS             RESTARTS   AGE
po/dapi-test-pod1             0/1       Terminating        0          22h
po/liveness-http              1/1       Running            11242      22d
po/ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2335       8d
 info: 1 completed object(s) was(were) not shown in pods list. Pass --show-all to see all objects.

NAME             STATUS    AGE
ns/default       Active    89d
ns/kube-system   Active    41d
```

### # kubectl get pods -a
```
NAME                       READY     STATUS             RESTARTS   AGE
busybox                    0/1       Error              0          27d
dapi-test-pod1             0/1       Terminating        0          22h
liveness-http              0/1       CrashLoopBackOff   11245      22d
ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2336       8d
```

### # kubectl get -h
```
Display one or many resources.

Possible resource types include (case insensitive): pods (aka 'po'), services (aka 'svc'), deployments (aka 'deploy'),
replicasets (aka 'rs'), replicationcontrollers (aka 'rc'), nodes (aka 'no'), events (aka 'ev'), limitranges (aka 'limits'),
persistentvolumes (aka 'pv'), persistentvolumeclaims (aka 'pvc'), resourcequotas (aka 'quota'), namespaces (aka 'ns'),
serviceaccounts (aka 'sa'), ingresses (aka 'ing'), horizontalpodautoscalers (aka 'hpa'), daemonsets (aka 'ds'), configmaps (aka 'cm'),
componentstatuses (aka 'cs), endpoints (aka 'ep'), petsets (alpha feature, may be unstable) and secrets.

This command will hide resources that have completed. For instance, pods that are in the Succeeded or Failed phases.
You can see the full results for any resource by providing the '--show-all' flag.

By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).

Examples:

.........
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

7 participants