mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
address comments
This commit is contained in:
parent
d8daa07f08
commit
178b5f7638
@ -18,6 +18,10 @@ stdout. You can optionally specify a directory with \-\-output\-directory. If y
|
|||||||
build a set of files in that directory. By default only dumps things in the 'kube\-system' namespace, but you can
|
build a set of files in that directory. By default only dumps things in the 'kube\-system' namespace, but you can
|
||||||
switch to a different namespace with the \-\-namespaces flag, or specify \-\-all\-namespaces to dump all namespaces.
|
switch to a different namespace with the \-\-namespaces flag, or specify \-\-all\-namespaces to dump all namespaces.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories
|
||||||
|
based on namespace and pod name.
|
||||||
|
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.PP
|
.PP
|
||||||
@ -131,6 +135,27 @@ switch to a different namespace with the \-\-namespaces flag, or specify \-\-all
|
|||||||
comma\-separated list of pattern=N settings for file\-filtered logging
|
comma\-separated list of pattern=N settings for file\-filtered logging
|
||||||
|
|
||||||
|
|
||||||
|
.SH EXAMPLE
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
# Dump current cluster state to stdout
|
||||||
|
kubectl cluster\-info dump
|
||||||
|
|
||||||
|
# Dump current cluster state to /path/to/cluster\-state
|
||||||
|
kubectl cluster\-info dump \-\-output\-directory=/path/to/cluster\-state
|
||||||
|
|
||||||
|
# Dump all namespaces to stdout
|
||||||
|
kubectl cluster\-info dump \-\-all\-namespaces
|
||||||
|
|
||||||
|
# Dump a set of namespaces to /path/to/cluster\-state
|
||||||
|
kubectl cluster\-info dump \-\-namespaces default,kube\-system \-\-output\-directory=/path/to/cluster\-state
|
||||||
|
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.PP
|
.PP
|
||||||
\fBkubectl\-cluster\-info(1)\fP,
|
\fBkubectl\-cluster\-info(1)\fP,
|
||||||
|
@ -14,6 +14,7 @@ kubectl cluster\-info \- Display cluster info
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
Display addresses of the master and services with label kubernetes.io/cluster\-service=true
|
Display addresses of the master and services with label kubernetes.io/cluster\-service=true
|
||||||
|
To further debug and diagnose cluster problems, use 'kubectl cluster\-info dump'.
|
||||||
|
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
@ -40,6 +40,7 @@ Display cluster info
|
|||||||
|
|
||||||
|
|
||||||
Display addresses of the master and services with label kubernetes.io/cluster-service=true
|
Display addresses of the master and services with label kubernetes.io/cluster-service=true
|
||||||
|
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl cluster-info
|
kubectl cluster-info
|
||||||
@ -84,7 +85,7 @@ kubectl cluster-info
|
|||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
* [kubectl cluster-info dump](kubectl_cluster-info_dump.md) - Dump lots of relevant info for debugging and diagnosis.
|
* [kubectl cluster-info dump](kubectl_cluster-info_dump.md) - Dump lots of relevant info for debugging and diagnosis.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 27-Apr-2016
|
###### Auto generated by spf13/cobra on 16-May-2016
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -40,11 +40,30 @@ stdout. You can optionally specify a directory with --output-directory. If you
|
|||||||
build a set of files in that directory. By default only dumps things in the 'kube-system' namespace, but you can
|
build a set of files in that directory. By default only dumps things in the 'kube-system' namespace, but you can
|
||||||
switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.
|
switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.
|
||||||
|
|
||||||
|
The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories
|
||||||
|
based on namespace and pod name.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl cluster-info dump
|
kubectl cluster-info dump
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Dump current cluster state to stdout
|
||||||
|
kubectl cluster-info dump
|
||||||
|
|
||||||
|
# Dump current cluster state to /path/to/cluster-state
|
||||||
|
kubectl cluster-info dump --output-directory=/path/to/cluster-state
|
||||||
|
|
||||||
|
# Dump all namespaces to stdout
|
||||||
|
kubectl cluster-info dump --all-namespaces
|
||||||
|
|
||||||
|
# Dump a set of namespaces to /path/to/cluster-state
|
||||||
|
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
|
||||||
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -85,7 +104,7 @@ kubectl cluster-info dump
|
|||||||
|
|
||||||
* [kubectl cluster-info](kubectl_cluster-info.md) - Display cluster info
|
* [kubectl cluster-info](kubectl_cluster-info.md) - Display cluster info
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 27-Apr-2016
|
###### Auto generated by spf13/cobra on 16-May-2016
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
name: cluster-info
|
name: cluster-info
|
||||||
synopsis: Display cluster info
|
synopsis: Display cluster info
|
||||||
description: |
|
description: |-
|
||||||
Display addresses of the master and services with label kubernetes.io/cluster-service=true
|
Display addresses of the master and services with label kubernetes.io/cluster-service=true
|
||||||
|
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
|
||||||
options:
|
options:
|
||||||
- name: include-extended-apis
|
- name: include-extended-apis
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
|
@ -33,9 +33,10 @@ import (
|
|||||||
// NewCmdCreateSecret groups subcommands to create various types of secrets
|
// NewCmdCreateSecret groups subcommands to create various types of secrets
|
||||||
func NewCmdClusterInfoDump(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
|
func NewCmdClusterInfoDump(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "dump",
|
Use: "dump",
|
||||||
Short: "Dump lots of relevant info for debugging and diagnosis.",
|
Short: "Dump lots of relevant info for debugging and diagnosis.",
|
||||||
Long: dumpLong + "\n" + dumpExample,
|
Long: dumpLong,
|
||||||
|
Example: dumpExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(dumpClusterInfo(f, cmd, args, cmdOut))
|
cmdutil.CheckErr(dumpClusterInfo(f, cmd, args, cmdOut))
|
||||||
},
|
},
|
||||||
@ -57,17 +58,17 @@ The command also dumps the logs of all of the pods in the cluster, these logs ar
|
|||||||
based on namespace and pod name.
|
based on namespace and pod name.
|
||||||
`
|
`
|
||||||
|
|
||||||
dumpExample = ` # Dump current cluster state to stdout
|
dumpExample = `# Dump current cluster state to stdout
|
||||||
kubectl cluster-info dump
|
kubectl cluster-info dump
|
||||||
|
|
||||||
# Dump current cluster state to /path/to/cluster-state
|
# Dump current cluster state to /path/to/cluster-state
|
||||||
kubectl cluster-info dump --output-directory=/path/to/cluster-state
|
kubectl cluster-info dump --output-directory=/path/to/cluster-state
|
||||||
|
|
||||||
# Dump all namespaces to stdout
|
# Dump all namespaces to stdout
|
||||||
kubectl cluster-info dump --all-namespaces
|
kubectl cluster-info dump --all-namespaces
|
||||||
|
|
||||||
# Dump a set of namespaces to /path/to/cluster-state
|
# Dump a set of namespaces to /path/to/cluster-state
|
||||||
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state`
|
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state`
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupOutputWriter(cmd *cobra.Command, defaultWriter io.Writer, filename string) io.Writer {
|
func setupOutputWriter(cmd *cobra.Command, defaultWriter io.Writer, filename string) io.Writer {
|
||||||
|
@ -24,21 +24,21 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetWriterNoOp(t *testing.T) {
|
func TestSetupOutputWriterNoOp(t *testing.T) {
|
||||||
tests := []string{"", "-"}
|
tests := []string{"", "-"}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
out := &bytes.Buffer{}
|
out := &bytes.Buffer{}
|
||||||
f, _, _ := NewAPIFactory()
|
f, _, _ := NewAPIFactory()
|
||||||
cmd := NewCmdClusterInfoDump(f, os.Stdout)
|
cmd := NewCmdClusterInfoDump(f, os.Stdout)
|
||||||
cmd.Flag("output-directory").Value.Set(test)
|
cmd.Flag("output-directory").Value.Set(test)
|
||||||
writer := getWriter(cmd, out, "/some/file/that/should/be/ignored")
|
writer := setupOutputWriter(cmd, out, "/some/file/that/should/be/ignored")
|
||||||
if writer != out {
|
if writer != out {
|
||||||
t.Errorf("expected: %v, saw: %v", out, writer)
|
t.Errorf("expected: %v, saw: %v", out, writer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetWriterFile(t *testing.T) {
|
func TestSetupOutputWriterFile(t *testing.T) {
|
||||||
file := "output.json"
|
file := "output.json"
|
||||||
dir, err := ioutil.TempDir(os.TempDir(), "out")
|
dir, err := ioutil.TempDir(os.TempDir(), "out")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -51,7 +51,7 @@ func TestGetWriterFile(t *testing.T) {
|
|||||||
f, _, _ := NewAPIFactory()
|
f, _, _ := NewAPIFactory()
|
||||||
cmd := NewCmdClusterInfoDump(f, os.Stdout)
|
cmd := NewCmdClusterInfoDump(f, os.Stdout)
|
||||||
cmd.Flag("output-directory").Value.Set(dir)
|
cmd.Flag("output-directory").Value.Set(dir)
|
||||||
writer := getWriter(cmd, out, file)
|
writer := setupOutputWriter(cmd, out, file)
|
||||||
if writer == out {
|
if writer == out {
|
||||||
t.Errorf("expected: %v, saw: %v", out, writer)
|
t.Errorf("expected: %v, saw: %v", out, writer)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user