From e089eab6fb4cfb69e230251b0e98f5998a9e0ca1 Mon Sep 17 00:00:00 2001 From: zwwhdls <33822635+zwwhdls@users.noreply.github.com> Date: Thu, 27 Jun 2019 02:17:21 +0800 Subject: [PATCH] =?UTF-8?q?update=20tutorial=20not=20to=20use=20=E2=80=98k?= =?UTF-8?q?ubectl=20run=E2=80=99=20for=20creating=20deployment=20(#14980)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update tutorial not to use ‘kubectl run’ for creating deployment * fix code stype * fix text stype * fix ordered list * delete blank line for md --- .../service-access-application-cluster.md | 23 +++++++++++-------- .../service/access/hello-application.yaml | 20 ++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 content/en/examples/service/access/hello-application.yaml diff --git a/content/en/docs/tasks/access-application-cluster/service-access-application-cluster.md b/content/en/docs/tasks/access-application-cluster/service-access-application-cluster.md index 9c312e003c..af5eb2db86 100644 --- a/content/en/docs/tasks/access-application-cluster/service-access-application-cluster.md +++ b/content/en/docs/tasks/access-application-cluster/service-access-application-cluster.md @@ -33,17 +33,22 @@ provides load balancing for an application that has two running instances. ## Creating a service for an application running in two pods +Here is the configuration file for the application Deployment: + +{{< codenew file="service/access/hello-application.yaml" >}} + 1. Run a Hello World application in your cluster: + Create the application Deployment using the file above: ```shell - kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080 - ``` - The preceding command creates a - [Deployment](/docs/concepts/workloads/controllers/deployment/) - object and an associated - [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/) - object. The ReplicaSet has two - [Pods](/docs/concepts/workloads/pods/pod/), - each of which runs the Hello World application. + kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml + ``` + The preceding command creates a + [Deployment](/docs/concepts/workloads/controllers/deployment/) + object and an associated + [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/) + object. The ReplicaSet has two + [Pods](/docs/concepts/workloads/pods/pod/), + each of which runs the Hello World application. 1. Display information about the Deployment: ```shell diff --git a/content/en/examples/service/access/hello-application.yaml b/content/en/examples/service/access/hello-application.yaml new file mode 100644 index 0000000000..1cf41313c5 --- /dev/null +++ b/content/en/examples/service/access/hello-application.yaml @@ -0,0 +1,20 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hello-world +spec: + selector: + matchLabels: + run: load-balancer-example + replicas: 2 + template: + metadata: + labels: + run: load-balancer-example + spec: + containers: + - name: hello-world + image: gcr.io/google-samples/node-hello:1.0 + ports: + - containerPort: 8080 + protocol: TCP