From f7512d007b0ac6a32a9325dcf506ec9d90d3560f Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Wed, 15 Jul 2015 17:20:39 -0700 Subject: [PATCH] Add munger to verify kubectl -f targets, fix docs --- cmd/mungedocs/kubectl_dash_f.go | 116 +++++++++++++++ cmd/mungedocs/kubectl_dash_f_test.go | 139 ++++++++++++++++++ cmd/mungedocs/mungedocs.go | 1 + docs/admin/resource-quota.md | 2 +- docs/admin/service-accounts-admin.md | 2 +- docs/devel/flaky-tests.md | 2 +- docs/getting-started-guides/aws-coreos.md | 2 +- .../coreos/azure/README.md | 12 +- .../fedora/fedora_manual_config.md | 4 +- docs/getting-started-guides/logging.md | 4 +- docs/getting-started-guides/mesos.md | 8 +- docs/man/man1/kubectl-create.1 | 2 +- docs/man/man1/kubectl-delete.1 | 2 +- docs/man/man1/kubectl-replace.1 | 4 +- docs/user-guide/configuring-containers.md | 4 +- docs/user-guide/connecting-applications.md | 10 +- docs/user-guide/deploying-applications.md | 2 +- docs/user-guide/getting-into-containers.md | 2 +- docs/user-guide/images.md | 8 +- .../user-guide/introspection-and-debugging.md | 2 +- docs/user-guide/kubectl/kubectl_create.md | 4 +- docs/user-guide/kubectl/kubectl_delete.md | 4 +- docs/user-guide/kubectl/kubectl_replace.md | 6 +- docs/user-guide/limitrange/README.md | 8 +- docs/user-guide/liveness/README.md | 4 +- docs/user-guide/logging.md | 2 +- docs/user-guide/managing-deployments.md | 23 ++- docs/user-guide/namespaces.md | 2 +- docs/user-guide/production-pods.md | 8 +- docs/user-guide/resourcequota/README.md | 6 +- docs/user-guide/service-accounts.md | 4 +- docs/user-guide/simple-yaml.md | 4 +- docs/user-guide/working-with-resources.md | 14 +- examples/aws_ebs/README.md | 2 +- examples/cassandra/README.md | 12 +- examples/elasticsearch/README.md | 6 +- examples/explorer/README.md | 2 +- examples/guestbook/README.md | 12 +- examples/hazelcast/README.md | 8 +- examples/https-nginx/README.md | 2 +- examples/iscsi/README.md | 2 +- examples/meteor/README.md | 8 +- examples/mysql-wordpress-pd/README.md | 12 +- examples/rethinkdb/README.md | 8 +- pkg/kubectl/cmd/create.go | 2 +- pkg/kubectl/cmd/delete.go | 2 +- pkg/kubectl/cmd/replace.go | 4 +- 47 files changed, 377 insertions(+), 122 deletions(-) create mode 100644 cmd/mungedocs/kubectl_dash_f.go create mode 100644 cmd/mungedocs/kubectl_dash_f_test.go diff --git a/cmd/mungedocs/kubectl_dash_f.go b/cmd/mungedocs/kubectl_dash_f.go new file mode 100644 index 0000000000000..103443e06ad69 --- /dev/null +++ b/cmd/mungedocs/kubectl_dash_f.go @@ -0,0 +1,116 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "os" + "path" + "strings" +) + +// Looks for lines that have kubectl commands with -f flags and files that +// don't exist. +func checkKubectlFileTargets(file string, markdown []byte) ([]byte, error) { + inside := false + lines := splitLines(markdown) + errors := []string{} + for i := range lines { + if strings.HasPrefix(lines[i], "```") { + inside = !inside + } + if inside { + if err := lookForKubectl(lines, i); err != nil { + errors = append(errors, err.Error()) + } + } + } + err := error(nil) + if len(errors) != 0 { + err = fmt.Errorf("%s", strings.Join(errors, "\n")) + } + return markdown, err +} + +func lookForKubectl(lines []string, lineNum int) error { + fields := strings.Fields(lines[lineNum]) + for i := range fields { + if fields[i] == "kubectl" { + return gotKubectl(lineNum, fields, i) + } + } + return nil +} + +func gotKubectl(line int, fields []string, fieldNum int) error { + for i := fieldNum + 1; i < len(fields); i++ { + switch fields[i] { + case "create", "update", "replace", "delete": + return gotCommand(line, fields, i) + } + } + return nil +} + +func gotCommand(line int, fields []string, fieldNum int) error { + for i := fieldNum + 1; i < len(fields); i++ { + if strings.HasPrefix(fields[i], "-f") { + return gotDashF(line, fields, i) + } + } + return nil +} + +func gotDashF(line int, fields []string, fieldNum int) error { + target := "" + if fields[fieldNum] == "-f" { + if fieldNum+1 == len(fields) { + return fmt.Errorf("ran out of fields after '-f'") + } + target = fields[fieldNum+1] + } else { + target = fields[fieldNum][2:] + } + // Turn dirs into file-like names. + target = strings.TrimRight(target, "/") + + // Now exclude special-cases + + if target == "-" || target == "FILENAME" { + // stdin and "FILENAME" are OK + return nil + } + if strings.HasPrefix(target, "http://") || strings.HasPrefix(target, "https://") { + // URLs are ok + return nil + } + if strings.HasPrefix(target, "./") { + // Same-dir files are usually created in the same example + return nil + } + if strings.HasPrefix(target, "/") { + // Absolute paths tend to be /tmp/* and created in the same example. + return nil + } + + // If we got here we expect the file to exist. + _, err := os.Stat(path.Join(*rootDir, *repoRoot, target)) + if os.IsNotExist(err) { + return fmt.Errorf("%d: target file %q does not exist", line, target) + } + return err +} diff --git a/cmd/mungedocs/kubectl_dash_f_test.go b/cmd/mungedocs/kubectl_dash_f_test.go new file mode 100644 index 0000000000000..9eb28ec7ad864 --- /dev/null +++ b/cmd/mungedocs/kubectl_dash_f_test.go @@ -0,0 +1,139 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import "testing" + +func TestKubectlDashF(t *testing.T) { + var cases = []struct { + in string + ok bool + }{ + // No match + {"", true}, + { + "Foo\nBar\n", + true, + }, + { + "Foo\nkubectl blah blech\nBar", + true, + }, + { + "Foo\n```shell\nkubectl blah blech\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create blech\n```\nBar", + true, + }, + // Special cases + { + "Foo\n```\nkubectl -blah create -f -\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f-\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f FILENAME\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -fFILENAME\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f http://google.com/foobar\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -fhttp://google.com/foobar\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f ./foobar\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f./foobar\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f /foobar\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -f/foobar\n```\nBar", + true, + }, + // Real checks + { + "Foo\n```\nkubectl -blah create -f mungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah create -fmungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah update -f mungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah update -fmungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah replace -f mungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah replace -fmungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah delete -f mungedocs.go\n```\nBar", + true, + }, + { + "Foo\n```\nkubectl -blah delete -fmungedocs.go\n```\nBar", + true, + }, + // Failures + { + "Foo\n```\nkubectl -blah delete -f does_not_exist\n```\nBar", + false, + }, + { + "Foo\n```\nkubectl -blah delete -fdoes_not_exist\n```\nBar", + false, + }, + } + for i, c := range cases { + *rootDir = "" + *repoRoot = "" + _, err := checkKubectlFileTargets("filename.md", []byte(c.in)) + if err != nil && c.ok { + t.Errorf("case[%d]: expected success, got %v", i, err) + } + if err == nil && !c.ok { + t.Errorf("case[%d]: unexpected success", i) + } + } +} diff --git a/cmd/mungedocs/mungedocs.go b/cmd/mungedocs/mungedocs.go index e452b0d2292d3..50b3aa5240f45 100644 --- a/cmd/mungedocs/mungedocs.go +++ b/cmd/mungedocs/mungedocs.go @@ -49,6 +49,7 @@ Examples: {"check-links", checkLinks}, {"unversioned-warning", updateUnversionedWarning}, {"analytics", checkAnalytics}, + {"kubectl-dash-f", checkKubectlFileTargets}, } availableMungeList = func() string { names := []string{} diff --git a/docs/admin/resource-quota.md b/docs/admin/resource-quota.md index fb551d8a8d7ed..059819c398bcc 100644 --- a/docs/admin/resource-quota.md +++ b/docs/admin/resource-quota.md @@ -93,7 +93,7 @@ $ cat < quota.json } } EOF -$ kubectl create -f quota.json +$ kubectl create -f ./quota.json $ kubectl get quota NAME quota diff --git a/docs/admin/service-accounts-admin.md b/docs/admin/service-accounts-admin.md index 397e92c294f68..d270c84f469d2 100644 --- a/docs/admin/service-accounts-admin.md +++ b/docs/admin/service-accounts-admin.md @@ -94,7 +94,7 @@ secret.json: "type": "kubernetes.io/service-account-token" } -$ kubectl create -f secret.json +$ kubectl create -f ./secret.json $ kubectl describe secret mysecretname ``` diff --git a/docs/devel/flaky-tests.md b/docs/devel/flaky-tests.md index fb000ea6f6363..86c898d9a2aff 100644 --- a/docs/devel/flaky-tests.md +++ b/docs/devel/flaky-tests.md @@ -56,7 +56,7 @@ spec: Note that we omit the labels and the selector fields of the replication controller, because they will be populated from the labels field of the pod template by default. ``` -kubectl create -f controller.yaml +kubectl create -f ./controller.yaml ``` This will spin up 24 instances of the test. They will run to completion, then exit, and the kubelet will restart them, accumulating more and more runs of the test. diff --git a/docs/getting-started-guides/aws-coreos.md b/docs/getting-started-guides/aws-coreos.md index 710bb1e792844..f46548fe6b81f 100644 --- a/docs/getting-started-guides/aws-coreos.md +++ b/docs/getting-started-guides/aws-coreos.md @@ -194,7 +194,7 @@ Create a pod manifest: `pod.json` ### Create the pod using the kubectl command line tool ```bash -kubectl create -f pod.json +kubectl create -f ./pod.json ``` ### Testing diff --git a/docs/getting-started-guides/coreos/azure/README.md b/docs/getting-started-guides/coreos/azure/README.md index 178eac267cf87..0cf8654a89bca 100644 --- a/docs/getting-started-guides/coreos/azure/README.md +++ b/docs/getting-started-guides/coreos/azure/README.md @@ -97,12 +97,12 @@ kube-02 environment=production Ready Let's follow the Guestbook example now: ``` cd guestbook-example -kubectl create -f redis-master-controller.json -kubectl create -f redis-master-service.json -kubectl create -f redis-slave-controller.json -kubectl create -f redis-slave-service.json -kubectl create -f frontend-controller.json -kubectl create -f frontend-service.json +kubectl create -f examples/guestbook/redis-master-controller.yaml +kubectl create -f examples/guestbook/redis-master-service.yaml +kubectl create -f examples/guestbook/redis-slave-controller.yaml +kubectl create -f examples/guestbook/redis-slave-service.yaml +kubectl create -f examples/guestbook/frontend-controller.yaml +kubectl create -f examples/guestbook/frontend-service.yaml ``` You need to wait for the pods to get deployed, run the following and wait for `STATUS` to change from `Unknown`, through `Pending` to `Running`. diff --git a/docs/getting-started-guides/fedora/fedora_manual_config.md b/docs/getting-started-guides/fedora/fedora_manual_config.md index ab8454d8e8070..bf58b5ef05bb7 100644 --- a/docs/getting-started-guides/fedora/fedora_manual_config.md +++ b/docs/getting-started-guides/fedora/fedora_manual_config.md @@ -146,7 +146,7 @@ done Now create a node object internally in your kubernetes cluster by running: ``` -$ kubectl create -f node.json +$ kubectl create -f ./node.json $ kubectl get nodes NAME LABELS STATUS @@ -205,7 +205,7 @@ fed-node name=fed-node-label Ready To delete _fed-node_ from your kubernetes cluster, one should run the following on fed-master (Please do not do it, it is just for information): ``` -$ kubectl delete -f node.json +$ kubectl delete -f ./node.json ``` *You should be finished!* diff --git a/docs/getting-started-guides/logging.md b/docs/getting-started-guides/logging.md index 62890d1eb6a46..bdac935005322 100644 --- a/docs/getting-started-guides/logging.md +++ b/docs/getting-started-guides/logging.md @@ -63,7 +63,7 @@ This pod specification has one container which runs a bash script when the conta namespace. ``` - $ kubectl create -f counter-pod.yaml + $ kubectl create -f examples/blog-logging/counter-pod.yaml pods/counter ``` @@ -114,7 +114,7 @@ pods/counter Now let’s restart the counter. ``` -$ kubectl create -f counter-pod.yaml +$ kubectl create -f examples/blog-logging/counter-pod.yaml pods/counter ``` Let’s wait for the container to restart and get the log lines again. diff --git a/docs/getting-started-guides/mesos.md b/docs/getting-started-guides/mesos.md index 8d3996195a9c6..76ffa2df0bc5c 100644 --- a/docs/getting-started-guides/mesos.md +++ b/docs/getting-started-guides/mesos.md @@ -198,7 +198,7 @@ EOPOD Send the pod description to Kubernetes using the `kubectl` CLI: ```bash -$ kubectl create -f nginx.yaml +$ kubectl create -f ./nginx.yaml pods/nginx ``` @@ -256,8 +256,8 @@ sed -e "s/{{ pillar\['dns_server'\] }}/10.10.10.10/g" \ Now the kube-dns pod and service are ready to be launched: ```bash -kubectl create -f skydns-rc.yaml -kubectl create -f skydns-svc.yaml +kubectl create -f ./skydns-rc.yaml +kubectl create -f ./skydns-svc.yaml ``` Check with `kubectl get pods --namespace=kube-system` that 3/3 containers of the pods are eventually up and running. Note that the kube-dns pods run in the `kube-system` namespace, not in `default`. @@ -286,7 +286,7 @@ EOF Then start the pod: ```bash -kubectl create -f busybox.yaml +kubectl create -f ./busybox.yaml ``` When the pod is up and running, start a lookup for the Kubernetes master service, made available on 10.10.10.1 by default: diff --git a/docs/man/man1/kubectl-create.1 b/docs/man/man1/kubectl-create.1 index b0c511d36d1b6..1229c0ca87623 100644 --- a/docs/man/man1/kubectl-create.1 +++ b/docs/man/man1/kubectl-create.1 @@ -133,7 +133,7 @@ JSON and YAML formats are accepted. .nf // Create a pod using the data in pod.json. -$ kubectl create \-f pod.json +$ kubectl create \-f ./pod.json // Create a pod based on the JSON passed into stdin. $ cat pod.json | kubectl create \-f \- diff --git a/docs/man/man1/kubectl-delete.1 b/docs/man/man1/kubectl-delete.1 index 4b63144c5505c..98681c763d0d9 100644 --- a/docs/man/man1/kubectl-delete.1 +++ b/docs/man/man1/kubectl-delete.1 @@ -166,7 +166,7 @@ will be lost along with the rest of the resource. .nf // Delete a pod using the type and name specified in pod.json. -$ kubectl delete \-f pod.json +$ kubectl delete \-f ./pod.json // Delete a pod based on the type and name in the JSON passed into stdin. $ cat pod.json | kubectl delete \-f \- diff --git a/docs/man/man1/kubectl-replace.1 b/docs/man/man1/kubectl-replace.1 index 14963e1ef84ce..0526ab833f34e 100644 --- a/docs/man/man1/kubectl-replace.1 +++ b/docs/man/man1/kubectl-replace.1 @@ -149,13 +149,13 @@ JSON and YAML formats are accepted. .nf // Replace a pod using the data in pod.json. -$ kubectl replace \-f pod.json +$ kubectl replace \-f ./pod.json // Replace a pod based on the JSON passed into stdin. $ cat pod.json | kubectl replace \-f \- // Force replace, delete and then re\-create the resource -kubectl replace \-\-force \-f pod.json +kubectl replace \-\-force \-f ./pod.json .fi .RE diff --git a/docs/user-guide/configuring-containers.md b/docs/user-guide/configuring-containers.md index a6eb38ff11878..d71ac7f17637b 100644 --- a/docs/user-guide/configuring-containers.md +++ b/docs/user-guide/configuring-containers.md @@ -71,7 +71,7 @@ The [`command`](containers.md#containers-and-commands) overrides the Docker cont This pod can be created using the `create` command: ```bash -$ kubectl create -f hello-world.yaml +$ kubectl create -f ./hello-world.yaml pods/hello-world ``` `kubectl` prints the resource type and name of the resource created when successful. @@ -80,7 +80,7 @@ pods/hello-world If you’re not sure you specified the resource correctly, you can ask `kubectl` to validate it for you: ```bash -$ kubectl create -f hello-world.yaml --validate +$ kubectl create -f ./hello-world.yaml --validate ``` Let’s say you specified `entrypoint` instead of `command`. You’d see output as follows: diff --git a/docs/user-guide/connecting-applications.md b/docs/user-guide/connecting-applications.md index cafacdd3ee890..789eb83b6988e 100644 --- a/docs/user-guide/connecting-applications.md +++ b/docs/user-guide/connecting-applications.md @@ -72,7 +72,7 @@ spec: This makes it accessible from any node in your cluster. Check the nodes the pod is running on: ```shell -$ kubectl create -f nginxrc.yaml +$ kubectl create -f ./nginxrc.yaml $ kubectl get pods -l app=nginx -o wide my-nginx-6isf4 1/1 Running 0 2h e2e-test-beeps-minion-93ly my-nginx-t26zt 1/1 Running 0 2h e2e-test-beeps-minion-93ly @@ -191,7 +191,7 @@ spec: ``` And perform a lookup of the nginx Service ```shell -$ kubectl create -f curlpod.yaml +$ kubectl create -f ./curlpod.yaml default/curlpod $ kubectl get pods curlpod NAME READY STATUS RESTARTS AGE @@ -275,7 +275,7 @@ Noteworthy points about the nginx-app manifest: - Each container has access to the keys through a volume mounted at /etc/nginx/ssl. This is setup *before* the nginx server is started. ```shell -$ kubectl delete rc,svc -l app=nginx; kubectl create -f nginx-app.yaml +$ kubectl delete rc,svc -l app=nginx; kubectl create -f ./nginx-app.yaml replicationcontrollers/my-nginx services/nginxsvc services/nginxsvc @@ -323,7 +323,7 @@ spec: - mountPath: /etc/nginx/ssl name: secret-volume -$ kubectl create -f curlpod.yaml +$ kubectl create -f ./curlpod.yaml $ kubectl get pods NAME READY STATUS RESTARTS AGE curlpod 1/1 Running 0 2m @@ -375,7 +375,7 @@ $ curl https://104.197.63.17:30645 -k Lets now recreate the Service to use a cloud load balancer, just change the `Type` of Service in the nginx-app.yaml from `NodePort` to `LoadBalancer`: ```shell $ kubectl delete rc, svc -l app=nginx -$ kubectl create -f nginx-app.yaml +$ kubectl create -f ./nginx-app.yaml $ kubectl get svc -o json | grep -i ingress -A 5 "ingress": [ { diff --git a/docs/user-guide/deploying-applications.md b/docs/user-guide/deploying-applications.md index a315225f912e7..cd5b940066c45 100644 --- a/docs/user-guide/deploying-applications.md +++ b/docs/user-guide/deploying-applications.md @@ -64,7 +64,7 @@ Some differences compared to specifying just a pod are that the `kind` is `Repli This replication controller can be created using `create`, just as with pods: ```bash -$ kubectl create -f nginx-rc.yaml +$ kubectl create -f ./nginx-rc.yaml replicationcontrollers/my-nginx ``` diff --git a/docs/user-guide/getting-into-containers.md b/docs/user-guide/getting-into-containers.md index bb6a39a786b77..048587989ab8c 100644 --- a/docs/user-guide/getting-into-containers.md +++ b/docs/user-guide/getting-into-containers.md @@ -53,7 +53,7 @@ We can use these environment variables in applications to find the service. It is convenient to use `kubectl exec` to check if the volumes are mounted as expected. We first create a Pod with a volume mounted at /data/redis, ``` -kubectl create -f docs/user-guide/walkthrough/pod2.yaml +kubectl create -f docs/user-guide/walkthrough/pod-redis.yaml ``` wait until the pod is Running and Ready, ``` diff --git a/docs/user-guide/images.md b/docs/user-guide/images.md index cceb2551627ed..026e287941c13 100644 --- a/docs/user-guide/images.md +++ b/docs/user-guide/images.md @@ -104,7 +104,7 @@ example, run these on your desktop/laptop: Verify by creating a pod that uses a private image, e.g.: ``` -$ cat < private-image-test-1.yaml +$ cat < /tmp/private-image-test-1.yaml apiVersion: v1 kind: Pod metadata: @@ -116,7 +116,7 @@ spec: command: [ "echo", "SUCCESS" ] imagePullPolicy: Always EOF -$ kubectl create -f private-image-test-1.yaml +$ kubectl create -f /tmp/private-image-test-1.yaml pods/private-image-test-1 $ ``` @@ -186,7 +186,7 @@ $ echo $(cat ~/.dockercfg) $ cat ~/.dockercfg | base64 eyAiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogeyAiYXV0aCI6ICJabUZyWlhCaGMzTjNiM0prTVRJSyIsICJlbWFpbCI6ICJqZG9lQGV4YW1wbGUuY29tIiB9IH0K -$ cat > image-pull-secret.yaml < /tmp/image-pull-secret.yaml < +$ kubectl create -f ./my-nginx-rc.yaml replicationcontrollers/my-nginx ``` diff --git a/docs/user-guide/kubectl/kubectl_create.md b/docs/user-guide/kubectl/kubectl_create.md index 3bad63701c416..7f6fc6c6cb9ab 100644 --- a/docs/user-guide/kubectl/kubectl_create.md +++ b/docs/user-guide/kubectl/kubectl_create.md @@ -39,7 +39,7 @@ kubectl create -f FILENAME ``` // Create a pod using the data in pod.json. -$ kubectl create -f pod.json +$ kubectl create -f ./pod.json // Create a pod based on the JSON passed into stdin. $ cat pod.json | kubectl create -f - @@ -84,7 +84,7 @@ $ cat pod.json | kubectl create -f - ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-14 00:11:42.955765309 +0000 UTC +###### Auto generated by spf13/cobra at 2015-07-16 22:39:16.132575015 +0000 UTC diff --git a/docs/user-guide/kubectl/kubectl_delete.md b/docs/user-guide/kubectl/kubectl_delete.md index 00bee6e57588f..7639f35295838 100644 --- a/docs/user-guide/kubectl/kubectl_delete.md +++ b/docs/user-guide/kubectl/kubectl_delete.md @@ -46,7 +46,7 @@ kubectl delete ([-f FILENAME] | (RESOURCE [(NAME | -l label | --all)] ``` // Delete a pod using the type and name specified in pod.json. -$ kubectl delete -f pod.json +$ kubectl delete -f ./pod.json // Delete a pod based on the type and name in the JSON passed into stdin. $ cat pod.json | kubectl delete -f - @@ -106,7 +106,7 @@ $ kubectl delete pods --all ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-14 00:11:42.95616314 +0000 UTC +###### Auto generated by spf13/cobra at 2015-07-16 05:13:00.190175769 +0000 UTC diff --git a/docs/user-guide/kubectl/kubectl_replace.md b/docs/user-guide/kubectl/kubectl_replace.md index a536a93c50d51..f281fec92bf8e 100644 --- a/docs/user-guide/kubectl/kubectl_replace.md +++ b/docs/user-guide/kubectl/kubectl_replace.md @@ -39,13 +39,13 @@ kubectl replace -f FILENAME ``` // Replace a pod using the data in pod.json. -$ kubectl replace -f pod.json +$ kubectl replace -f ./pod.json // Replace a pod based on the JSON passed into stdin. $ cat pod.json | kubectl replace -f - // Force replace, delete and then re-create the resource -kubectl replace --force -f pod.json +kubectl replace --force -f ./pod.json ``` ### Options @@ -91,7 +91,7 @@ kubectl replace --force -f pod.json ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-14 00:11:42.955895303 +0000 UTC +###### Auto generated by spf13/cobra at 2015-07-16 22:39:16.132838722 +0000 UTC diff --git a/docs/user-guide/limitrange/README.md b/docs/user-guide/limitrange/README.md index 13c74680b8e79..03481f6fa963f 100644 --- a/docs/user-guide/limitrange/README.md +++ b/docs/user-guide/limitrange/README.md @@ -62,7 +62,7 @@ This example will work in a custom namespace to demonstrate the concepts involve Let's create a new namespace called limit-example: ```shell -$ kubectl create -f namespace.yaml +$ kubectl create -f docs/user-guide/limitrange/namespace.yaml namespaces/limit-example $ kubectl get namespaces NAME LABELS STATUS @@ -75,7 +75,7 @@ Step 2: Apply a limit to the namespace Let's create a simple limit in our namespace. ```shell -$ kubectl create -f limits.yaml --namespace=limit-example +$ kubectl create -f docs/user-guide/limitrange/limits.yaml --namespace=limit-example limitranges/mylimits ``` @@ -140,14 +140,14 @@ Note that our nginx container has picked up the namespace default cpu and memory Let's create a pod that exceeds our allowed limits by having it have a container that requests 3 cpu cores. ```shell -$ kubectl create -f invalid-pod.yaml --namespace=limit-example +$ kubectl create -f docs/user-guide/limitrange/invalid-pod.yaml --namespace=limit-example Error from server: Pod "invalid-pod" is forbidden: Maximum CPU usage per pod is 2, but requested 3 ``` Let's create a pod that falls within the allowed limit boundaries. ```shell -$ kubectl create -f valid-pod.yaml --namespace=limit-example +$ kubectl create -f docs/user-guide/limitrange/valid-pod.yaml --namespace=limit-example pods/valid-pod $ kubectl get pods valid-pod --namespace=limit-example -o yaml | grep -C 5 resources containers: diff --git a/docs/user-guide/liveness/README.md b/docs/user-guide/liveness/README.md index 69541a601447b..b76ef5a50385e 100644 --- a/docs/user-guide/liveness/README.md +++ b/docs/user-guide/liveness/README.md @@ -58,8 +58,8 @@ This [guide](../walkthrough/k8s201.md#health-checking) has more information on h ## Get your hands dirty To show the health check is actually working, first create the pods: ``` -# kubectl create -f exec-liveness.yaml -# kubectl create -f http-liveness.yaml +# kubectl create -f docs/user-guide/liveness/exec-liveness.yaml +# kubectl create -f docs/user-guide/liveness/http-liveness.yaml ``` Check the status of the pods once they are created: diff --git a/docs/user-guide/logging.md b/docs/user-guide/logging.md index 8971d232a4e40..1a1f4b4797863 100644 --- a/docs/user-guide/logging.md +++ b/docs/user-guide/logging.md @@ -43,7 +43,7 @@ output every second [counter-pod.yaml](../../examples/blog-logging/counter-pod.y ``` we can run the pod: ``` - $ kubectl create -f counter-pod.yaml + $ kubectl create -f ./counter-pod.yaml pods/counter ``` and then fetch the logs: diff --git a/docs/user-guide/managing-deployments.md b/docs/user-guide/managing-deployments.md index 9af539fc50bce..313c202ba1f72 100644 --- a/docs/user-guide/managing-deployments.md +++ b/docs/user-guide/managing-deployments.md @@ -78,7 +78,7 @@ spec: Multiple resources can be created the same way as a single resource: ```bash -$ kubectl create -f nginx-app.yaml +$ kubectl create -f ./nginx-app.yaml services/my-nginx-svc replicationcontrollers/my-nginx ``` @@ -87,12 +87,12 @@ The resources will be created in the order they appear in the file. Therefore, i `kubectl create` also accepts multiple `-f` arguments: ```bash -$ kubectl create -f nginx-svc.yaml -f nginx-rc.yaml +$ kubectl create -f ./nginx-svc.yaml -f ./nginx-rc.yaml ``` And a directory can be specified rather than or in addition to individual files: ```bash -$ kubectl create -f nginx/ +$ kubectl create -f ./nginx/ ``` `kubectl` will read any files with suffixes `.yaml`, `.yml`, or `.json`. @@ -107,7 +107,7 @@ replicationcontrollers/nginx Resource creation isn’t the only operation that `kubectl` can perform in bulk. It can also extract resource names from configuration files in order to perform other operations, in particular to delete the same resources you created: ```bash -$ kubectl delete -f nginx/ +$ kubectl delete -f ./nginx/ replicationcontrollers/my-nginx services/my-nginx-svc ``` @@ -126,7 +126,7 @@ services/my-nginx-svc Because `kubectl` outputs resource names in the same syntax it accepts, it’s easy to chain operations using `$()` or `xargs`: ```bash -$ kubectl get $(kubectl create -f nginx/ | grep my-nginx) +$ kubectl get $(kubectl create -f ./nginx/ | grep my-nginx) CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS my-nginx nginx nginx app=nginx 2 NAME LABELS SELECTOR IP(S) PORT(S) @@ -158,7 +158,7 @@ and ``` The labels allow us to slice and dice our resources along any dimension specified by a label: ```bash -$ kubectl create -f guestbook-fe.yaml -f redis-master.yaml -f redis-slave.yaml +$ kubectl create -f ./guestbook-fe.yaml -f ./redis-master.yaml -f ./redis-slave.yaml replicationcontrollers/guestbook-fe replicationcontrollers/guestbook-redis-master replicationcontrollers/guestbook-redis-slave @@ -339,7 +339,7 @@ spec: ``` and roll it out: ```bash -$ kubectl rolling-update my-nginx -f nginx-rc.yaml +$ kubectl rolling-update my-nginx -f ./nginx-rc.yaml Creating my-nginx-v4 At beginning of loop: my-nginx replicas: 4, my-nginx-v4 replicas: 1 Updating my-nginx replicas: 4, my-nginx-v4 replicas: 1 @@ -380,10 +380,9 @@ The patch is specified using json. For more significant changes, you can `get` the resource, edit it, and then `replace` the resource with the updated version: ```bash -$ export TMP=/tmp/nginx.yaml -$ kubectl get rc my-nginx-v4 -o yaml > $TMP -$ emacs $TMP -$ kubectl replace -f $TMP +$ kubectl get rc my-nginx-v4 -o yaml > /tmp/nginx.yaml +$ vi /tmp/nginx.yaml +$ kubectl replace -f /tmp/nginx.yaml replicationcontrollers/my-nginx-v4 $ rm $TMP ``` @@ -392,7 +391,7 @@ The system ensures that you don’t clobber changes made by other users or compo In some cases, you may need to update resource fields that cannot be updated once initialized, or you may just want to make a recursive change immediately, such as to fix broken pods created by a replication controller. To change such fields, use `replace --force`, which deletes and re-creates the resource. In this case, you can simply modify your original configuration file: ```bash -$ kubectl replace -f nginx-rc.yaml --force +$ kubectl replace -f ./nginx-rc.yaml --force replicationcontrollers/my-nginx-v4 replicationcontrollers/my-nginx-v4 ``` diff --git a/docs/user-guide/namespaces.md b/docs/user-guide/namespaces.md index 0e5c6da6fb113..bbc5b99f085d5 100644 --- a/docs/user-guide/namespaces.md +++ b/docs/user-guide/namespaces.md @@ -129,7 +129,7 @@ More information on the ```finalizers``` field can be found in the namespace [de Then run: ``` -kubectl create -f my-namespace.yaml +kubectl create -f ./my-namespace.yaml ``` ### Setting the namespace for a request diff --git a/docs/user-guide/production-pods.md b/docs/user-guide/production-pods.md index fb7242dfd5b21..f851edd249acd 100644 --- a/docs/user-guide/production-pods.md +++ b/docs/user-guide/production-pods.md @@ -91,7 +91,7 @@ data: ``` As with other resources, this secret can be instantiated using `create` and can be viewed with `get`: ```bash -$ kubectl create -f secret.yaml +$ kubectl create -f ./secret.yaml secrets/mysecret $ kubectl get secrets NAME TYPE DATA @@ -154,7 +154,7 @@ $ echo $(cat ~/.dockercfg) $ cat ~/.dockercfg | base64 eyAiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogeyAiYXV0aCI6ICJabUZyWlhCaGMzTjNiM0prTVRJSyIsICJlbWFpbCI6ICJqZG9lQGV4YW1wbGUuY29tIiB9IH0K -$ cat > image-pull-secret.yaml < /tmp/image-pull-secret.yaml < Active @@ -53,7 +53,7 @@ and API resources (pods, services, etc.) that a namespace may consume. Let's create a simple quota in our namespace: ```shell -$ kubectl create -f quota.yaml --namespace=quota-example +$ kubectl create -f docs/user-guide/resourcequota/quota.yaml --namespace=quota-example ``` Once your quota is applied to a namespace, the system will restrict any creation of content @@ -121,7 +121,7 @@ do not specify any memory usage. So let's set some default limits for the amount of cpu and memory a pod can consume: ```shell -$ kubectl create -f limits.yaml --namespace=quota-example +$ kubectl create -f docs/user-guide/resourcequota/limits.yaml --namespace=quota-example limitranges/limits $ kubectl describe limits limits --namespace=quota-example Name: limits diff --git a/docs/user-guide/service-accounts.md b/docs/user-guide/service-accounts.md index 4ca142e2993e5..8410b05a4c6aa 100644 --- a/docs/user-guide/service-accounts.md +++ b/docs/user-guide/service-accounts.md @@ -62,13 +62,13 @@ default 1 You can create additional serviceAccounts like this: ``` -$ cat > serviceaccount.yaml < /tmp/serviceaccount.yaml < original.yaml < /tmp/original.yaml < current.yaml +$ kubectl get pods/original -o yaml > /tmp/current.yaml pods/original -$ wc -l original.yaml current.yaml - 51 current.yaml - 9 original.yaml +$ wc -l /tmp/original.yaml /tmp/current.yaml + 51 /tmp/current.yaml + 9 /tmp/original.yaml 60 total ``` The resource we posted had only 9 lines, but the one we got back had 51 lines. -If you `diff original.yaml current.yaml`, you can see the fields added to the pod. +If you `diff -u /tmp/original.yaml /tmp/current.yaml`, you can see the fields added to the pod. The system adds fields in several ways: - Some fields are added synchronously with creation of the resource and some are set asynchronously. - For example: `metadata.uid` is set synchronously. (Read more about [metadata](../devel/api-conventions.md#metadata)). diff --git a/examples/aws_ebs/README.md b/examples/aws_ebs/README.md index 6e255707ce02a..758656a90e349 100644 --- a/examples/aws_ebs/README.md +++ b/examples/aws_ebs/README.md @@ -27,7 +27,7 @@ Create a volume in the same region as your node add your volume information in the pod description file aws-ebs-web.yaml then create the pod: ```shell - $ kubectl create -f aws-ebs-web.yaml + $ kubectl create -f examples/aws_ebs/aws-ebs-web.yaml ``` Add some data to the volume if is empty: ```shell diff --git a/examples/cassandra/README.md b/examples/cassandra/README.md index d4771206eff2c..d5dc9647ce423 100644 --- a/examples/cassandra/README.md +++ b/examples/cassandra/README.md @@ -104,13 +104,13 @@ The important thing to note here is the ```selector```. It is a query over label Create this service as follows: ```sh -$ kubectl create -f cassandra-service.yaml +$ kubectl create -f examples/cassandra/cassandra-service.yaml ``` Now, as the service is running, we can create the first Cassandra pod using the mentioned specification. ```sh -$ kubectl create -f cassandra.yaml +$ kubectl create -f examples/cassandra/cassandra.yaml ``` After a few moments, you should be able to see the pod running, plus its single container: @@ -208,7 +208,7 @@ Most of this replication controller definition is identical to the Cassandra pod Create this controller: ```sh -$ kubectl create -f cassandra-controller.yaml +$ kubectl create -f examples/cassandra/cassandra-controller.yaml ``` Now this is actually not that interesting, since we haven't actually done anything new. Now it will get interesting. @@ -267,13 +267,13 @@ For those of you who are impatient, here is the summary of the commands we ran i ```sh # create a service to track all cassandra nodes -kubectl create -f cassandra-service.yaml +kubectl create -f examples/cassandra/cassandra-service.yaml # create a single cassandra node -kubectl create -f cassandra.yaml +kubectl create -f examples/cassandra/cassandra.yaml # create a replication controller to replicate cassandra nodes -kubectl create -f cassandra-controller.yaml +kubectl create -f examples/cassandra/cassandra-controller.yaml # scale up to 2 nodes kubectl scale rc cassandra --replicas=2 diff --git a/examples/elasticsearch/README.md b/examples/elasticsearch/README.md index 993f76c026e46..04db5a023c7ff 100644 --- a/examples/elasticsearch/README.md +++ b/examples/elasticsearch/README.md @@ -125,13 +125,13 @@ data: ``` which can be used to create the secret in your namespace: ``` -kubectl create -f apiserver-secret.yaml --namespace=mytunes +kubectl create -f examples/elasticsearch/apiserver-secret.yaml --namespace=mytunes secrets/apiserver-secret ``` Now you are ready to create the replication controller which will then create the pods: ``` -$ kubectl create -f music-rc.yaml --namespace=mytunes +$ kubectl create -f examples/elasticsearch/music-rc.yaml --namespace=mytunes replicationcontrollers/music-db ``` @@ -156,7 +156,7 @@ spec: ``` Let's create the service with an external load balancer: ``` -$ kubectl create -f music-service.yaml --namespace=mytunes +$ kubectl create -f examples/elasticsearch/music-service.yaml --namespace=mytunes services/music-server ``` diff --git a/examples/explorer/README.md b/examples/explorer/README.md index 814ae6e34013e..6cef7b9c405f6 100644 --- a/examples/explorer/README.md +++ b/examples/explorer/README.md @@ -35,7 +35,7 @@ Currently, you can look at: Example from command line (the DNS lookup looks better from a web browser): ``` -$ kubectl create -f pod.json +$ kubectl create -f examples/explorer/pod.json $ kubectl proxy & Starting to serve on localhost:8001 diff --git a/examples/guestbook/README.md b/examples/guestbook/README.md index 4cf437fabd6f0..3fe001f86d4cd 100644 --- a/examples/guestbook/README.md +++ b/examples/guestbook/README.md @@ -93,7 +93,7 @@ spec: Change to the `/examples/guestbook` directory if you're not already there. Create the redis master pod in your Kubernetes cluster by running: ```shell -$ kubectl create -f redis-master-controller.yaml +$ kubectl create -f examples/guestbook/redis-master-controller.yaml replicationcontrollers/redis-master ``` @@ -208,7 +208,7 @@ spec: Create the service by running: ```shell -$ kubectl create -f redis-master-service.yaml +$ kubectl create -f examples/guestbook/redis-master-service.yaml services/redis-master ``` Then check the list of services, which should include the redis-master: @@ -276,7 +276,7 @@ spec: and create the replication controller by running: ```shell -$ kubectl create -f redis-slave-controller.yaml +$ kubectl create -f examples/guestbook/redis-slave-controller.yaml replicationcontrollers/redis-slave $ kubectl get rc @@ -324,7 +324,7 @@ This time the selector for the service is `name=redis-slave`, because that ident Now that you have created the service specification, create it in your cluster by running: ```shell -$ kubectl create -f redis-slave-service.yaml +$ kubectl create -f examples/guestbook/redis-slave-service.yaml services/redis-slave $ kubectl get services @@ -367,7 +367,7 @@ spec: Using this file, you can turn up your frontend with: ```shell -$ kubectl create -f frontend-controller.yaml +$ kubectl create -f examples/guestbook/frontend-controller.yaml replicationcontrollers/frontend ``` @@ -476,7 +476,7 @@ To do this, uncomment the `type: LoadBalancer` line in the `frontend-service.yam Create the service like this: ```shell -$ kubectl create -f frontend-service.yaml +$ kubectl create -f examples/guestbook/frontend-service.yaml services/frontend ``` diff --git a/examples/hazelcast/README.md b/examples/hazelcast/README.md index c5e792aeadab9..8bcb0ec20b073 100644 --- a/examples/hazelcast/README.md +++ b/examples/hazelcast/README.md @@ -69,7 +69,7 @@ The important thing to note here is the `selector`. It is a query over labels, t Create this service as follows: ```sh -$ kubectl create -f hazelcast-service.yaml +$ kubectl create -f examples/hazelcast/hazelcast-service.yaml ``` ### Adding replicated nodes @@ -124,7 +124,7 @@ Last but not least, we set `DNS_DOMAIN` environment variable according to your K Create this controller: ```sh -$ kubectl create -f hazelcast-controller.yaml +$ kubectl create -f examples/hazelcast/hazelcast-controller.yaml ``` After the controller provisions successfully the pod, you can query the service endpoints: @@ -230,10 +230,10 @@ For those of you who are impatient, here is the summary of the commands we ran i ```sh # create a service to track all hazelcast nodes -kubectl create -f hazelcast-service.yaml +kubectl create -f examples/hazelcast/hazelcast-service.yaml # create a replication controller to replicate hazelcast nodes -kubectl create -f hazelcast-controller.yaml +kubectl create -f examples/hazelcast/hazelcast-controller.yaml # scale up to 2 nodes kubectl scale rc hazelcast --replicas=2 diff --git a/examples/https-nginx/README.md b/examples/https-nginx/README.md index 9256cbe2d692c..cfbc4093372bb 100644 --- a/examples/https-nginx/README.md +++ b/examples/https-nginx/README.md @@ -40,7 +40,7 @@ You need a [running kubernetes cluster](../../docs/getting-started-guides/) for $ kubectl create -f /tmp/secret.json secrets/nginxsecret -$ kubectl create -f nginx-app.yaml +$ kubectl create -f examples/https-nginx/nginx-app.yaml services/nginxsvc replicationcontrollers/my-nginx diff --git a/examples/iscsi/README.md b/examples/iscsi/README.md index d3616c1f06557..a476a881ddf73 100644 --- a/examples/iscsi/README.md +++ b/examples/iscsi/README.md @@ -52,7 +52,7 @@ mkfs.ext4 /dev/ Once your pod is created, run it on the Kubernetes master: ```console -kubectl create -f your_new_pod.json +kubectl create -f ./your_new_pod.json ``` Here is my command and output: diff --git a/examples/meteor/README.md b/examples/meteor/README.md index 4e3f64c44f5f4..0d35e7bcd1416 100644 --- a/examples/meteor/README.md +++ b/examples/meteor/README.md @@ -135,14 +135,14 @@ gcloud compute disks create --size=200GB mongo-disk Now you can start Mongo using that disk: ``` -kubectl create -f mongo-pod.json -kubectl create -f mongo-service.json +kubectl create -f examples/meteor/mongo-pod.json +kubectl create -f examples/meteor/mongo-service.json ``` Wait until Mongo is started completely and then start up your Meteor app: ``` -kubectl create -f meteor-controller.json -kubectl create -f meteor-service.json +kubectl create -f examples/meteor/meteor-controller.json +kubectl create -f examples/meteor/meteor-service.json ``` Note that [`meteor-service.json`](meteor-service.json) creates a load balancer, so diff --git a/examples/mysql-wordpress-pd/README.md b/examples/mysql-wordpress-pd/README.md index 3cf9ecc776f1f..d8323bfff770c 100644 --- a/examples/mysql-wordpress-pd/README.md +++ b/examples/mysql-wordpress-pd/README.md @@ -122,7 +122,7 @@ Note that we've defined a volume mount for `/var/lib/mysql`, and specified a vol Once you've edited the file to set your database password, create the pod as follows, where `` is the path to your Kubernetes installation: ```shell -$ kubectl create -f mysql.yaml +$ kubectl create -f examples/mysql-wordpress-pd/mysql.yaml ``` It may take a short period before the new pod reaches the `Running` state. @@ -171,7 +171,7 @@ spec: Start the service like this: ```shell -$ kubectl create -f mysql-service.yaml +$ kubectl create -f examples/mysql-wordpress-pd/mysql-service.yaml ``` You can see what services are running via: @@ -221,7 +221,7 @@ spec: Create the pod: ```shell -$ kubectl create -f wordpress.yaml +$ kubectl create -f examples/mysql-wordpress-pd/wordpress.yaml ``` And list the pods to check that the status of the new pod changes @@ -260,7 +260,7 @@ Note also that we've set the service port to 80. We'll return to that shortly. Start the service: ```shell -$ kubectl create -f wordpress-service.yaml +$ kubectl create -f examples/mysql-wordpress-pd/wordpress-service.yaml ``` and see it in the list of services: @@ -307,8 +307,8 @@ Set up your WordPress blog and play around with it a bit. Then, take down its p If you are just experimenting, you can take down and bring up only the pods: ```shell -$ kubectl delete -f wordpress.yaml -$ kubectl delete -f mysql.yaml +$ kubectl delete -f examples/mysql-wordpress-pd/wordpress.yaml +$ kubectl delete -f examples/mysql-wordpress-pd/mysql.yaml ``` When you restart the pods again (using the `create` operation as described above), their services will pick up the new pods based on their labels. diff --git a/examples/rethinkdb/README.md b/examples/rethinkdb/README.md index f67ff37e81d31..ede15f4bf4f0a 100644 --- a/examples/rethinkdb/README.md +++ b/examples/rethinkdb/README.md @@ -39,7 +39,7 @@ Rethinkdb will discover peer using endpoints provided by kubernetes service, so first create a service so the following pod can query its endpoint ```shell -$kubectl create -f driver-service.yaml +$kubectl create -f examples/rethinkdb/driver-service.yaml ``` check out: @@ -56,7 +56,7 @@ rethinkdb-driver db=influxdb db=rethinkdb 10.0.27.114 28015/TCP start fist server in cluster ```shell -$kubectl create -f rc.yaml +$kubectl create -f examples/rethinkdb/rc.yaml ``` Actually, you can start servers as many as you want at one time, just modify the `replicas` in `rc.ymal` @@ -99,8 +99,8 @@ Admin You need a separate pod (labeled as role:admin) to access Web Admin UI ```shell -kubectl create -f admin-pod.yaml -kubectl create -f admin-service.yaml +kubectl create -f examples/rethinkdb/admin-pod.yaml +kubectl create -f examples/rethinkdb/admin-service.yaml ``` find the service diff --git a/pkg/kubectl/cmd/create.go b/pkg/kubectl/cmd/create.go index 7415291997f92..f10bba566cdd9 100644 --- a/pkg/kubectl/cmd/create.go +++ b/pkg/kubectl/cmd/create.go @@ -36,7 +36,7 @@ const ( JSON and YAML formats are accepted.` create_example = `// Create a pod using the data in pod.json. -$ kubectl create -f pod.json +$ kubectl create -f ./pod.json // Create a pod based on the JSON passed into stdin. $ cat pod.json | kubectl create -f -` diff --git a/pkg/kubectl/cmd/delete.go b/pkg/kubectl/cmd/delete.go index c237a14a4d97b..aa1c3a4208cf8 100644 --- a/pkg/kubectl/cmd/delete.go +++ b/pkg/kubectl/cmd/delete.go @@ -43,7 +43,7 @@ Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.` delete_example = `// Delete a pod using the type and name specified in pod.json. -$ kubectl delete -f pod.json +$ kubectl delete -f ./pod.json // Delete a pod based on the type and name in the JSON passed into stdin. $ cat pod.json | kubectl delete -f - diff --git a/pkg/kubectl/cmd/replace.go b/pkg/kubectl/cmd/replace.go index 94152d6105266..c5433fdadc9cc 100644 --- a/pkg/kubectl/cmd/replace.go +++ b/pkg/kubectl/cmd/replace.go @@ -35,13 +35,13 @@ const ( JSON and YAML formats are accepted.` replace_example = `// Replace a pod using the data in pod.json. -$ kubectl replace -f pod.json +$ kubectl replace -f ./pod.json // Replace a pod based on the JSON passed into stdin. $ cat pod.json | kubectl replace -f - // Force replace, delete and then re-create the resource -kubectl replace --force -f pod.json` +kubectl replace --force -f ./pod.json` ) func NewCmdReplace(f *cmdutil.Factory, out io.Writer) *cobra.Command {