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

add document on kubectl's behavior regarding initializers #5505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/user-guide/kubectl-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ $ kubectl get services # List all services in the names
$ kubectl get pods --all-namespaces # List all pods in all namespaces
$ kubectl get pods -o wide # List all pods in the namespace, with more details
$ kubectl get deployment my-dep # List a particular deployment
$ kubectl get pods --include-uninitialized # List all pods in the namespace, including uninitialized ones

# Describe commands with verbose output
$ kubectl describe nodes my-node
Expand Down Expand Up @@ -193,10 +194,11 @@ $ kubectl scale --replicas=5 rc/foo rc/bar rc/baz # Scale mult
## Deleting Resources

```console
$ kubectl delete -f ./pod.json # Delete a pod using the type and name specified in pod.json
$ kubectl delete pod,service baz foo # Delete pods and services with same names "baz" and "foo"
$ kubectl delete pods,services -l name=myLabel # Delete pods and services with label name=myLabel
$ kubectl -n my-ns delete po,svc --all # Delete all pods and services in namespace my-ns
$ kubectl delete -f ./pod.json # Delete a pod using the type and name specified in pod.json
$ kubectl delete pod,service baz foo # Delete pods and services with same names "baz" and "foo"
$ kubectl delete pods,services -l name=myLabel # Delete pods and services with label name=myLabel
$ kubectl delete pods,services -l name=myLabel --include-uninitialized # Delete pods and services, including uninitialized ones, with label name=myLabel
$ kubectl -n my-ns delete po,svc --all # Delete all pods and services, including uninitialized ones, in namespace my-ns,
```

## Interacting with running Pods
Expand Down
13 changes: 11 additions & 2 deletions docs/user-guide/kubectl-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,12 @@ $ kubectl get replicationcontroller <rc-name>

// List all replication controllers and services together in plain-text output format.
$ kubectl get rc,services

// List all daemon sets, including uninitialized ones, in plain-text output format.
$ kubectl get ds --include-uninitialized
```

`kubectl describe` - Display detailed state of one or more resources.
`kubectl describe` - Display detailed state of one or more resources, including the uninitialized ones by default.

```shell
// Display the details of the node with name <node-name>.
Expand All @@ -252,6 +255,9 @@ $ kubectl describe pods/<pod-name>
// Display the details of all the pods that are managed by the replication controller named <rc-name>.
// Remember: Any pods that are created by the replication controller get prefixed with the name of the replication controller.
$ kubectl describe pods <rc-name>

// Describe all pods, not including uninitialized ones
$ kubectl describe pods --include-uninitialized=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I remember correctly, kubectl describe pods --include-uninitialized=false is already the default setting, right? if so, it's not worth explaining here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubectl describe pods --include-uninitialized=false is already the default setting, right?

@ahmetb uninitialized pods are included as default. So passing this flag to override the default setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dixudx is right :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I recall that we decided not to include uninitialized for bulk update/list calls.

It is unintuitive that kubectl get does not include uninitialized by default, but kubectl describe includes uninitialized by default. I'm not sure what's the reasoning behind that.

```

`kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
Expand All @@ -263,7 +269,10 @@ $ kubectl delete -f pod.yaml
// Delete all the pods and services that have the label name=<label-name>.
$ kubectl delete pods,services -l name=<label-name>

// Delete all pods.
// Delete all the pods and services that have the label name=<label-name>, including uninitialized ones.
$ kubectl delete pods,services -l name=<label-name> --include-uninitialized

// Delete all pods, including uninitialized ones.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if --all deletes uninitialized? Commenting just to doublecheck.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if --all deletes uninitialized?

@ahmetb @caesarxuchao If flag --all is set, uninitialized ones are included as default.

Also kubernetes/kubernetes#51186 solved the bug when deleting uninitialized resources.

I've re-tested using master branch, it works as expected.

$ kubectl delete pods --all
```

Expand Down