update tutorial not to use ‘kubectl run’ for creating deployment (#14980)
* update tutorial not to use ‘kubectl run’ for creating deployment * fix code stype * fix text stype * fix ordered list * delete blank line for md
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
cb574f4b75
commit
e089eab6fb
+14
-9
@@ -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
|
## 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:
|
1. Run a Hello World application in your cluster:
|
||||||
|
Create the application Deployment using the file above:
|
||||||
```shell
|
```shell
|
||||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
|
||||||
```
|
```
|
||||||
The preceding command creates a
|
The preceding command creates a
|
||||||
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
||||||
object and an associated
|
object and an associated
|
||||||
[ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
|
[ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
|
||||||
object. The ReplicaSet has two
|
object. The ReplicaSet has two
|
||||||
[Pods](/docs/concepts/workloads/pods/pod/),
|
[Pods](/docs/concepts/workloads/pods/pod/),
|
||||||
each of which runs the Hello World application.
|
each of which runs the Hello World application.
|
||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user