kubernetes实战-基于redis和docker的留言簿案例

来源:互联网 发布:ios更新系统 数据丢失 编辑:程序博客网 时间:2024/03/29 20:41
一、介绍
本案例基于Kubernetes和Docker,其中包括
1、web前端
2、redis master
3、redis slave
其中web前端通过javascript redis api和redis master交互

kubernetes体系架构


二、配置
0、先决条件
Kubernetes 集群

1、启动redis master
使用replication controller确保只有一个pod在运行(当某个节点down了,rc会在另一个健康的node启动redis master),但可能会有数据丢失。
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">controller</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">replicationcontrollers</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get rc</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">CONTROLLER     CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   SELECTOR            REPLICAS</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   master         redis      name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">1</span></code></div></div>
验证master运行成功,如下展示了pod运行在centos2/192.168.1.112这台机器上    
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get pods</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">POD                  IP           CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   HOST                    LABELS              STATUS    CREATED      MESSAGE</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">svar7   </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.9</span><span class="pln" style="color: rgb(72, 72, 76);">                             centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">55</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                  master         redis                                                  </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">55</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div></div>
SSH到centos2/192.168.1.112查看docker状态
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos2 yum</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">repos</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">d</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> docker ps</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">CONTAINER ID        IMAGE                                  COMMAND                CREATED             STATUS              PORTS               NAMES</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="lit" style="color: rgb(25, 95, 145);">91689ce56668</span><span class="pln" style="color: rgb(72, 72, 76);">        redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">latest                           </span><span class="str" style="color: rgb(221, 17, 68);">"/entrypoint.sh redi   3 minutes ago       Up 3 minutes                            k8s_master.52732b08_redis-master-svar7_default_5b6d5485-1894-11e5-b3ad-000c293c8c19_97e79b7b   </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="str" style="color: rgb(221, 17, 68);">38c3180813c3        gcr.io/google_containers/pause:0.8.0   "</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">pause</span><span class="str" style="color: rgb(221, 17, 68);">"               3 minutes ago       Up 3 minutes                            k8s_POD.49eee8c2_redis-master-svar7_default_5b6d5485-1894-11e5-b3ad-000c293c8c19_298e038f      </span></code></div></div>
注意:kubectl create执行后,如果镜像不存在,会执行docker pull,根据网络情况,下载中的pods 在kubertnetes UI上会显示pending状态

2、启动master service
一个kubernetes service会对一个或多个container进行负载均衡,这是通过我们上面redis-master中定义的labels元数据实现的,值得注意的是,在redis中只有一个master,但是我们依然为它创建一个service,这是因为这样我们就能使用一个elastic IP来路由到具体某一个master。
kubernetes集群中的service是通过container中的环境变量实现服务发现的,service基于pod label实现container的负载均衡。
在第一步中创建的pod包含了一个label“name=redis-master”,service的selector字段决定了service将流量转发给哪个pod,port和targetPort信息定义了service proxy运行在什么端口。
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">service</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">services</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get services</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">NAME            LABELS                                    SELECTOR            IP</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">           PORT</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master    name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master                         name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div></div>
上面的运行成功后,所有pods都能发现redis master运行在6379端口,从salve到master流量走向会有以下两步:
1、一个redis slave会连接到redis master service的port上
2、流量会从service节点上的port到targetPort
如果targetPort未指定,默认和port一致

3、启动replicated slave pod
虽然redis master是一个单独的pod,redis slaves是一个replicated pod,在Kubernetes中,一个Replication Controller负责管理一个replicated pod的多个实例,RC会自动拉起down掉的replica(可以通过杀死docker 进程方式简单测试)
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">controller</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">replicationcontrollers</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get rc</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">CONTROLLER     CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">                    SELECTOR            REPLICAS</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   master         redis                       name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">1</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">2</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get pods</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">POD                  IP            CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">                    HOST                    LABELS              STATUS    CREATED      MESSAGE</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">svar7   </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.9</span><span class="pln" style="color: rgb(72, 72, 76);">                                               centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">41</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   master         redis                                                                   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">41</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="lit" style="color: rgb(25, 95, 145);">31tkb</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.10</span><span class="pln" style="color: rgb(72, 72, 76);">                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">29</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">28</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">uk8nu    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.11</span><span class="pln" style="color: rgb(72, 72, 76);">                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">29</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">28</span><span class="pln" style="color: rgb(72, 72, 76);"> seconds   </span></code></div></div>
可以看到一个master pod和两个slave pod

4、启动slave service
和master一样,我们希望有一个代理服务连接到redis slave,除了服务发现之外,slave service还为web app client提供了透明代理。
这次service 的selector是name=redis-slave,我们可以方便的使用kubectl get services -l "label=value"命令来定位这些服务
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">service</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">services</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get services</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">NAME            LABELS                                    SELECTOR            IP</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">            PORT</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master    name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master                         name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave     name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave                          name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">159.145</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div></div>

5、创建frontend pod
这是一个简单的PHP 服务,用来和master service(写请求)或slave service(读请求)交互
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">controller</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">replicationcontrollers</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">frontend</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get rc</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">CONTROLLER     CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">                                    SELECTOR            REPLICAS</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend       php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="lit" style="color: rgb(25, 95, 145);">3</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   master         redis                                       name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">1</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">2</span></code></div></div>
运行成功后,查看当前pod运行状态
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get pods</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">POD                  IP            CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">                                    HOST                    LABELS              STATUS    CREATED      MESSAGE</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">fr5z1       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.13</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">gjx3t       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.14</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">v608r       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.12</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes    </span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">svar7   </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.9</span><span class="pln" style="color: rgb(72, 72, 76);">                                                               centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">53</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   master         redis                                                                                   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">53</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="lit" style="color: rgb(25, 95, 145);">31tkb</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.10</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">12</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">12</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">uk8nu    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.11</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">12</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">12</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes   </span></code></div></div>
可以看到一个redis master,两个redis slave和三个frontend pods

6、创建guestbook service
和其他service一样,你可以创建一个service管理frontend pods
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl create </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">f frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">service</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">json </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">services</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">frontend</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get services</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">NAME            LABELS                                    SELECTOR            IP</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">            PORT</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend        name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend                             name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.111</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">80</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master    name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master                         name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave     name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave                          name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">159.145</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div></div>
我们可以通过frontend service(10.254.154.111)访问pods,但是这个IP明显是无法在外部访问的,下一节讲解如何在外部网络访问guestbook

7、外部网络访问guestbook
kubernetes 支持两种访问暴露一个服务到外部IP地址NodePorts 和LoadBalancers,https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/services.md#external-services
另外可以查看防火墙,找到service对应的端口,如下
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get pods</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">services</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">POD                  IP            CONTAINER</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">   IMAGE</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">                                    HOST                    LABELS              STATUS    CREATED         MESSAGE</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">fr5z1       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.13</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">gjx3t       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.14</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">v608r       </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.12</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis      kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">example</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">guestbook</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">php</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">22</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">svar7   </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.9</span><span class="pln" style="color: rgb(72, 72, 76);">                                                               centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="typ" style="color: teal;">About</span><span class="pln" style="color: rgb(72, 72, 76);"> an hour   </span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   master         redis                                                                                   </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="typ" style="color: teal;">About</span><span class="pln" style="color: rgb(72, 72, 76);"> an hour   </span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="lit" style="color: rgb(25, 95, 145);">31tkb</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.10</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">32</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">32</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">uk8nu    </span><span class="lit" style="color: rgb(25, 95, 145);">172.17</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.11</span><span class="pln" style="color: rgb(72, 72, 76);">                                                              centos2</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pln" style="color: rgb(72, 72, 76);">   name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">32</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                                   slave          kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);">v2                                                               </span><span class="typ" style="color: teal;">Running</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">32</span><span class="pln" style="color: rgb(72, 72, 76);"> minutes      </span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">NAME            LABELS                                    SELECTOR            IP</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">            PORT</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend        name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend                             name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.111</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">80</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">kubernetes      component</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">apiserver</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">provider</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">kubernetes   </span><span class="pun" style="color: rgb(147, 161, 161);"><</span><span class="pln" style="color: rgb(72, 72, 76);">none</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);">              </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.2</span><span class="pln" style="color: rgb(72, 72, 76);">       </span><span class="lit" style="color: rgb(25, 95, 145);">443</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">ro   component</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">apiserver</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">provider</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">kubernetes   </span><span class="pun" style="color: rgb(147, 161, 161);"><</span><span class="pln" style="color: rgb(72, 72, 76);">none</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);">              </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.1</span><span class="pln" style="color: rgb(72, 72, 76);">       </span><span class="lit" style="color: rgb(25, 95, 145);">80</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master    name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master                         name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave     name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave                          name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">159.145</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos1 example</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> kubectl get services</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">NAME            LABELS                                    SELECTOR            IP</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="pln" style="color: rgb(72, 72, 76);">            PORT</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);">S</span><span class="pun" style="color: rgb(147, 161, 161);">)</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">frontend        name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend                             name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">frontend       </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.111</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">80</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">kubernetes      component</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">apiserver</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">provider</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">kubernetes   </span><span class="pun" style="color: rgb(147, 161, 161);"><</span><span class="pln" style="color: rgb(72, 72, 76);">none</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);">              </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.2</span><span class="pln" style="color: rgb(72, 72, 76);">       </span><span class="lit" style="color: rgb(25, 95, 145);">443</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">kubernetes</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">ro   component</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">apiserver</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">provider</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">kubernetes   </span><span class="pun" style="color: rgb(147, 161, 161);"><</span><span class="pln" style="color: rgb(72, 72, 76);">none</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);">              </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.1</span><span class="pln" style="color: rgb(72, 72, 76);">       </span><span class="lit" style="color: rgb(25, 95, 145);">80</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master    name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master                         name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">master   </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pln" style="color: rgb(72, 72, 76);">    </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave     name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave                          name</span><span class="pun" style="color: rgb(147, 161, 161);">=</span><span class="pln" style="color: rgb(72, 72, 76);">redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">slave    </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">159.145</span><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="pln" style="color: rgb(72, 72, 76);">TCP</span></code></div></div>
发现redis-master是在10.254.154.90上,登录到centos2上,执行iptables-save,发现其中有这样一条规则
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">A KUBE</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">PORTALS</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">HOST </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">d </span><span class="lit" style="color: rgb(25, 95, 145);">10.254</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">154.90</span><span class="pun" style="color: rgb(147, 161, 161);">/</span><span class="lit" style="color: rgb(25, 95, 145);">32</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">p tcp </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">m comment </span><span class="pun" style="color: rgb(147, 161, 161);">--</span><span class="pln" style="color: rgb(72, 72, 76);">comment </span><span class="str" style="color: rgb(221, 17, 68);">"default/redis-master:"</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">m tcp </span><span class="pun" style="color: rgb(147, 161, 161);">--</span><span class="pln" style="color: rgb(72, 72, 76);">dport </span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">j DNAT </span><span class="pun" style="color: rgb(147, 161, 161);">--</span><span class="pln" style="color: rgb(72, 72, 76);">to</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">destination </span><span class="lit" style="color: rgb(25, 95, 145);">192.168</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">1.112</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">49038</span></code></div></div>
说明,centos2本机的49038端口映射到master container内的6379了,当然我们就能执行在本机访问redis了
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">[</span><span class="pln" style="color: rgb(72, 72, 76);">root@centos2 yum</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">repos</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">d</span><span class="pun" style="color: rgb(147, 161, 161);">]#</span><span class="pln" style="color: rgb(72, 72, 76);"> redis</span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">cli </span><span class="pun" style="color: rgb(147, 161, 161);">-</span><span class="pln" style="color: rgb(72, 72, 76);">p </span><span class="lit" style="color: rgb(25, 95, 145);">49038</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="lit" style="color: rgb(25, 95, 145);">127.0</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.1</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">49038</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">set</span><span class="pln" style="color: rgb(72, 72, 76);"> a b</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">OK</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="lit" style="color: rgb(25, 95, 145);">127.0</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="lit" style="color: rgb(25, 95, 145);">0.1</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">49038</span><span class="pun" style="color: rgb(147, 161, 161);">></span><span class="pln" style="color: rgb(72, 72, 76);"> get a</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="str" style="color: rgb(221, 17, 68);">"b"</span></code></div></div>

8、使用curl简单测试
提交数据
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">curl </span><span class="str" style="color: rgb(221, 17, 68);">"localhost:8000/index.php?cmd=set&key=messages&value=jay_sais_hi"</span></code></div></div>
查询数据
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">curl </span><span class="str" style="color: rgb(221, 17, 68);">"localhost:8000/index.php?cmd=get&key=messages"</span></code></div></div>

附本案例用到的6个.json文件
1、redis-master-controller.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"ReplicationController"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"replicas"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">1</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"template"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"containers"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"master"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"image"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                        </span><span class="str" style="color: rgb(221, 17, 68);">"containerPort"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">6379</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>
2、redis-master-service.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"Service"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">[</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">          </span><span class="str" style="color: rgb(221, 17, 68);">"port"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">6379</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">          </span><span class="str" style="color: rgb(221, 17, 68);">"targetPort"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">6379</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">],</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-master"</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>
3、redis-slave-controller.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"ReplicationController"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"replicas"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">2</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"template"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"containers"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"slave"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"image"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"kubernetes/redis-slave:v2"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                        </span><span class="str" style="color: rgb(221, 17, 68);">"containerPort"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">6379</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>
4、redis-slave-service.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"Service"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">[</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">          </span><span class="str" style="color: rgb(221, 17, 68);">"port"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">6379</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">],</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"redis-slave"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>
5、frontend-controller.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"ReplicationController"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"replicas"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">3</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"template"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="str" style="color: rgb(221, 17, 68);">"containers"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"php-redis"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"image"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"kubernetes/example-guestbook-php-redis:v2"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:[</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                        </span><span class="str" style="color: rgb(221, 17, 68);">"containerPort"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">80</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                     </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">                  </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">               </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">            </span><span class="pun" style="color: rgb(147, 161, 161);">]</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>
6、frontend-service.json
<div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"kind"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"Service"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"apiVersion"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"v1beta3"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"metadata"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span><span class="pun" style="color: rgb(147, 161, 161);">,</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"labels"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">},</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="str" style="color: rgb(221, 17, 68);">"spec"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"ports"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">[</span></code></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">{</span></code></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">          </span><span class="str" style="color: rgb(221, 17, 68);">"port"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">80</span></code></div><div class="L3" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">        </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">],</span></code></div><div class="L5" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="str" style="color: rgb(221, 17, 68);">"selector"</span><span class="pun" style="color: rgb(147, 161, 161);">:{</span></code></div><div class="L6" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">         </span><span class="str" style="color: rgb(221, 17, 68);">"name"</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">"frontend"</span></code></div><div class="L7" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">      </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L8" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pln" style="color: rgb(72, 72, 76);">   </span><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div><div class="L9" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sh" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="pun" style="color: rgb(147, 161, 161);">}</span></code></div></div>

0 0
原创粉丝点击