烂翻译系列之Kubernetes实战——Kiada套件简介

The Kubernetes in Action Demo Application is a web-based application that shows quotes from this book, asks you Kubernetes-related questions to help you check how your knowledge is progressing, and provides a list of hyperlinks to external websites related to Kubernetes or this book. It also prints out the information about the container that served processed the browser’s request. You’ll soon see why this is important.

Kubernetes实战示例应用是一个web应用,它显示这本书的引述,提出Kubernetes相关问题来帮助你检查知识掌握程度,并提供了一个链接到与Kubernetes或本书相关的外部网站超链接列表。它也输出容器(为处理浏览器请求提供服务)相关信息。你很快就会知道为什么这很重要。

The look and operation of the application  应用的外观和操作

A screenshot of the web application is presented in the following figure.

下图显示这个web应用的截图

 

The architecture of the Kiada application is shown in the next figure. The HTML is served by a web application running in a Node.js server. The client-side JavaScript code then retrieves the quote and question from the Quote and the Quiz RESTful services. The Node.js application and the services comprise the complete Kiada Suite.

下图显示Kiada应用的架构。运行在Node.js服务中的web应用提供HTML。客户端JavaScript代码从Quote服务和Quiz RESTful服务取回引述和问题。Node.js应用和服务组成完整的Kiada套件。

The web browser talks directly to three different services. If you’re familiar with microservice architectures, you might wonder why no API gateway exists in the system. This is so that I can demonstrate the issues and solutions associated with cases where many different services are deployed in Kubernetes (services that may not belong behind the same API gateway). But chapter 11 will also explain how to introduce Kubernetes-native API gateways into the system.

web浏览器直接与三个不同的服务通信。如果你对微服务架构不熟悉,你可能对为什么系统中没有API网关存在感到惊讶。这样我才能说明问题(与在Kubernetes中许多不同的服务部署在哪里相关的问题,服务可能不在同一个API网关之后)和解决办法。但第11章将要说明如何在系统中引入Kubernetes原生API网关。

The look and operation of the plain-text version  纯文本的外观和操作

You’ll spend a lot of time interacting with Kubernetes via a terminal, so you may not want to go back and forth between it and a web browser when you perform the exercises. For this reason, the application can also be used in plain-text mode.

你将花很多时间通过终端与Kubernetes交互,所以当你做练习时,你可能不想往返于终端和浏览器之间。为此,应用也可以以纯文本模式使用。

The plain-text mode allows you to use the application directly from the terminal using a tool such as curl. In that case, the response sent by the application looks like the following:

纯文本模式允许你通过curl这类工具在直接在终端上使用应用。那样的话,应用返回的响应看上去像下面这样:

==== TIP OF THE MINUTE
Liveness probes can only be used in the pod’s regular containers. 
They can’t be defined in init containers.
 
==== POP QUIZ
Third question
0) First answer
1) Second answer
2) Third answer
 
Submit your answer to /question/0/answers/<index of answer> using the POST method.
 
==== REQUEST INFO
Request processed by Kubia 1.0 running in pod "kiada-ssl" on node "kind-worker".
Pod hostname: kiada-ssl; Pod IP: 10.244.2.188; Node IP: 172.18.0.2; Client IP: 127.0.0.1

The HTML version is accessible at the request URI /html, whereas the text version is at /text. If the client requests the root URI path /, the application inspects the Accept request header to guess whether the client is a graphical web browser, in which case it redirects it to /html, or a text-based tool like curl, in which case it sends the plain-text response.

HTML版本可通过请求URI /html访问,而text版本可在请求/text时访问。如果客户端请求根URI路径/,应用检查请求头来判断客户端是web浏览器(这样的话,服务重定向到/html),还是类似curl这种基于文本的工具(这样的话,服务发送纯文本响应)

In this mode of operation, it’s the Node.js application that calls the Quote and the Quiz services, as shown in the next figure.

在这种操作模式中,Node.js应用调用Quote和Quiz服务,如下图所示。

 

From a networking standpoint, this mode of operation is much different than the one described previously. In this case, the Quote and the Quiz service are invoked within the cluster, whereas previously, they were invoked directly from the browser. To support both operation modes, the services must therefore be exposed both internally and externally.

从网络的角度看,这种操作模式和前一种模式有很大的不同。在这种模式下,Quote和Quiz服务在集群内部被调用,而前一种模式,它们都由浏览器直接调用。为支持两种操作模式,服务必须对内和对外都公开。

NOTE
注意 The initial version of the application will not connect to any services. You’ll build and incorporate the services in later chapters.
初始版本的应用不与任何服务连接。你将在后面的章节中构建并接入服务。

 

posted @ 2021-12-22 17:15  菜鸟吊思  阅读(130)  评论(0)    收藏  举报