Reference glossary definitions in “Connect a Front End to a Back End Using a Service” (#12706)
* Reference terms in glossary * Enable syntax highlighting for shell snippets
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
2f6bee10ca
commit
04ddaa4711
@@ -8,14 +8,15 @@ weight: 70
|
|||||||
|
|
||||||
This task shows how to create a frontend and a backend
|
This task shows how to create a frontend and a backend
|
||||||
microservice. The backend microservice is a hello greeter. The
|
microservice. The backend microservice is a hello greeter. The
|
||||||
frontend and backend are connected using a Kubernetes Service object.
|
frontend and backend are connected using a Kubernetes
|
||||||
|
{{< glossary_tooltip term_id="service" >}} object.
|
||||||
|
|
||||||
{{% /capture %}}
|
{{% /capture %}}
|
||||||
|
|
||||||
|
|
||||||
{{% capture objectives %}}
|
{{% capture objectives %}}
|
||||||
|
|
||||||
* Create and run a microservice using a Deployment object.
|
* Create and run a microservice using a {{< glossary_tooltip term_id="deployment" >}} object.
|
||||||
* Route traffic to the backend using a frontend.
|
* Route traffic to the backend using a frontend.
|
||||||
* Use a Service object to connect the frontend application to the
|
* Use a Service object to connect the frontend application to the
|
||||||
backend application.
|
backend application.
|
||||||
@@ -47,13 +48,13 @@ file for the backend Deployment:
|
|||||||
|
|
||||||
Create the backend Deployment:
|
Create the backend Deployment:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
kubectl create -f https://k8s.io/examples/service/access/hello.yaml
|
kubectl create -f https://k8s.io/examples/service/access/hello.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
View information about the backend Deployment:
|
View information about the backend Deployment:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
kubectl describe deployment hello
|
kubectl describe deployment hello
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -99,7 +100,8 @@ Events:
|
|||||||
The key to connecting a frontend to a backend is the backend
|
The key to connecting a frontend to a backend is the backend
|
||||||
Service. A Service creates a persistent IP address and DNS name entry
|
Service. A Service creates a persistent IP address and DNS name entry
|
||||||
so that the backend microservice can always be reached. A Service uses
|
so that the backend microservice can always be reached. A Service uses
|
||||||
selector labels to find the Pods that it routes traffic to.
|
{{< glossary_tooltip text="selectors" term_id="selector" >}} to find
|
||||||
|
the Pods that it routes traffic to.
|
||||||
|
|
||||||
First, explore the Service configuration file:
|
First, explore the Service configuration file:
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ that have the labels `app: hello` and `tier: backend`.
|
|||||||
|
|
||||||
Create the `hello` Service:
|
Create the `hello` Service:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
kubectl create -f https://k8s.io/examples/service/access/hello-service.yaml
|
kubectl create -f https://k8s.io/examples/service/access/hello-service.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -137,7 +139,7 @@ the Service uses the default load balancer of your cloud provider.
|
|||||||
|
|
||||||
Create the frontend Deployment and Service:
|
Create the frontend Deployment and Service:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
kubectl create -f https://k8s.io/examples/service/access/frontend.yaml
|
kubectl create -f https://k8s.io/examples/service/access/frontend.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -161,7 +163,7 @@ so that you can change the configuration more easily.
|
|||||||
Once you’ve created a Service of type LoadBalancer, you can use this
|
Once you’ve created a Service of type LoadBalancer, you can use this
|
||||||
command to find the external IP:
|
command to find the external IP:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
kubectl get service frontend --watch
|
kubectl get service frontend --watch
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -189,8 +191,8 @@ cluster.
|
|||||||
The frontend and backends are now connected. You can hit the endpoint
|
The frontend and backends are now connected. You can hit the endpoint
|
||||||
by using the curl command on the external IP of your frontend Service.
|
by using the curl command on the external IP of your frontend Service.
|
||||||
|
|
||||||
```
|
```shell
|
||||||
curl http://<EXTERNAL-IP>
|
curl http://${EXTERNAL_IP} # replace this with the EXTERNAL-IP you saw earlier
|
||||||
```
|
```
|
||||||
|
|
||||||
The output shows the message generated by the backend:
|
The output shows the message generated by the backend:
|
||||||
|
|||||||
Reference in New Issue
Block a user