From 4d2f3c1c176f506338ff485564407f796399cf84 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Tue, 22 Mar 2016 11:43:28 -0700 Subject: [PATCH] Update docs to reflect `kubectl run` creates deployments by default instead of replicatino controllers. --- docs/man/man1/kubectl-expose.1 | 2 +- docs/user-guide/kubectl-overview.md | 2 +- docs/user-guide/kubectl/kubectl.md | 2 +- docs/user-guide/kubectl/kubectl_expose.md | 2 +- examples/selenium/README.md | 2 +- examples/simple-nginx.md | 22 ++++++++++++---------- pkg/kubectl/cmd/expose.go | 2 +- test/images/resource-consumer/README.md | 7 +++---- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/docs/man/man1/kubectl-expose.1 b/docs/man/man1/kubectl-expose.1 index efadb138f5a..380dbacae8a 100644 --- a/docs/man/man1/kubectl-expose.1 +++ b/docs/man/man1/kubectl-expose.1 @@ -3,7 +3,7 @@ .SH NAME .PP -kubectl expose \- Take a replication controller, service, or pod and expose it as a new Kubernetes Service +kubectl expose \- Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service .SH SYNOPSIS diff --git a/docs/user-guide/kubectl-overview.md b/docs/user-guide/kubectl-overview.md index d54bc7562af..7beb5e3949f 100644 --- a/docs/user-guide/kubectl-overview.md +++ b/docs/user-guide/kubectl-overview.md @@ -112,7 +112,7 @@ Operation | Syntax | Description `describe` | `kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]` | Display the detailed state of one or more resources. `edit` | `kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]` | Edit and update the definition of one or more resources on the server by using the default editor. `exec` | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | Execute a command against a container in a pod. -`expose` | `kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type] [flags]` | Expose a replication controller, service, or pod as a new Kubernetes service. +`expose` | `kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type] [flags]` | Expose a replication controller, service, deployment or pod as a new Kubernetes service. `get` | `kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]` | List one or more resources. `label` | `kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]` | Add or update the labels of one or more resources. `logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | Print the logs for a container in a pod. diff --git a/docs/user-guide/kubectl/kubectl.md b/docs/user-guide/kubectl/kubectl.md index cc8c9aff3f9..83d3370e9da 100644 --- a/docs/user-guide/kubectl/kubectl.md +++ b/docs/user-guide/kubectl/kubectl.md @@ -92,7 +92,7 @@ kubectl * [kubectl edit](kubectl_edit.md) - Edit a resource on the server * [kubectl exec](kubectl_exec.md) - Execute a command in a container. * [kubectl explain](kubectl_explain.md) - Documentation of resources. -* [kubectl expose](kubectl_expose.md) - Take a replication controller, service, or pod and expose it as a new Kubernetes Service +* [kubectl expose](kubectl_expose.md) - Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service * [kubectl get](kubectl_get.md) - Display one or many resources * [kubectl label](kubectl_label.md) - Update the labels on a resource * [kubectl logs](kubectl_logs.md) - Print the logs for a container in a pod. diff --git a/docs/user-guide/kubectl/kubectl_expose.md b/docs/user-guide/kubectl/kubectl_expose.md index 8e67cb9ead9..1f466ef29bd 100644 --- a/docs/user-guide/kubectl/kubectl_expose.md +++ b/docs/user-guide/kubectl/kubectl_expose.md @@ -34,7 +34,7 @@ Documentation for other releases can be found at ## kubectl expose -Take a replication controller, service, or pod and expose it as a new Kubernetes Service +Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service ### Synopsis diff --git a/examples/selenium/README.md b/examples/selenium/README.md index e0b59fe6fe9..2246c5edf1c 100644 --- a/examples/selenium/README.md +++ b/examples/selenium/README.md @@ -222,7 +222,7 @@ To remove all created resources, run the following: kubectl delete rc selenium-hub kubectl delete rc selenium-node-chrome kubectl delete rc selenium-node-firefox -kubectl delete rc selenium-python +kubectl delete deployment selenium-python kubectl delete svc selenium-hub kubectl delete svc selenium-hub-external ``` diff --git a/examples/simple-nginx.md b/examples/simple-nginx.md index d5fa2ddaa1c..57ef12cda0f 100644 --- a/examples/simple-nginx.md +++ b/examples/simple-nginx.md @@ -42,7 +42,7 @@ to Kubernetes and running your first containers on the cluster. From this point onwards, it is assumed that `kubectl` is on your path from one of the getting started guides. -The [`kubectl run`](../docs/user-guide/kubectl/kubectl_run.md) line below will create two [nginx](https://registry.hub.docker.com/_/nginx/) [pods](../docs/user-guide/pods.md) listening on port 80. It will also create a [replication controller](../docs/user-guide/replication-controller.md) named `my-nginx` to ensure that there are always two pods running. +The [`kubectl run`](../docs/user-guide/kubectl/kubectl_run.md) line below will create two [nginx](https://registry.hub.docker.com/_/nginx/) [pods](../docs/user-guide/pods.md) listening on port 80. It will also create a [deployment](../docs/user-guide/deployments.md) named `my-nginx` to ensure that there are always two pods running. ```bash kubectl run my-nginx --image=nginx --replicas=2 --port=80 @@ -54,16 +54,10 @@ Once the pods are created, you can list them to see what is up and running: kubectl get pods ``` -You can also see the replication controller that was created: +You can also see the deployment that was created: ```bash -kubectl get rc -``` - -To delete the two replicated containers, delete the replication controller: - -```bash -kubectl delete rc my-nginx +kubectl get deployment ``` ### Exposing your pods to the internet. @@ -72,7 +66,7 @@ On some platforms (for example Google Compute Engine) the kubectl command can in to do this run: ```bash -kubectl expose rc my-nginx --port=80 --type=LoadBalancer +kubectl expose deployment my-nginx --port=80 --type=LoadBalancer ``` This should print the service that has been created, and map an external IP address to the service. Where to find this external IP address will depend on the environment you run in. For instance, for Google Compute Engine the external IP address is listed as part of the newly created service and can be retrieved by running @@ -83,6 +77,14 @@ kubectl get services In order to access your nginx landing page, you also have to make sure that traffic from external IPs is allowed. Do this by opening a firewall to allow traffic on port 80. +### Cleanup + +To delete the two replicated containers, delete the deployment: + +```bash +kubectl delete deployment my-nginx +``` + ### Next: Configuration files Most people will eventually want to use declarative configuration files for creating/modifying their applications. A [simplified introduction](../docs/user-guide/deploying-applications.md) diff --git a/pkg/kubectl/cmd/expose.go b/pkg/kubectl/cmd/expose.go index 785449382fe..9070fbcad88 100644 --- a/pkg/kubectl/cmd/expose.go +++ b/pkg/kubectl/cmd/expose.go @@ -73,7 +73,7 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]", - Short: "Take a replication controller, service, or pod and expose it as a new Kubernetes Service", + Short: "Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service", Long: expose_long, Example: expose_example, Run: func(cmd *cobra.Command, args []string) { diff --git a/test/images/resource-consumer/README.md b/test/images/resource-consumer/README.md index a0b11de5c6c..19801af8e3d 100644 --- a/test/images/resource-consumer/README.md +++ b/test/images/resource-consumer/README.md @@ -48,15 +48,14 @@ Custom metrics in Prometheus format are exposed on "/metrics" endpoint. ###CURL example ```console -$ kubectl run resource-consumer --image=gcr.io/google_containers/resource_consumer:beta -$ kubectl expose rc resource-consumer --create-external-load-balancer=true --port=8080 --target-port=8080 +$ kubectl run resource-consumer --image=gcr.io/google_containers/resource_consumer:beta --expose --service-overrides='{ "spec": { "type": "LoadBalancer" } }' --port 8080 $ kubectl get services resource-consumer ``` -There are two IPs first one is internal, second one is the external load-balanced IP. Both serving port 8080. (Use second one) +There are two IPs. The first one is internal, while the second one is the external load-balanced IP. Both serve port 8080. (Use second one) ```console -$ curl --data "millicores=300&durationSec=600" http://104.197.103.250:8080/ConsumeCPU. +$ curl --data "millicores=300&durationSec=600" http://:8080/ConsumeCPU ``` 300 millicores will be consumed for 600 seconds.