Service
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1"
|
||||
id="svg2" inkscape:export-filename="/usr/local/google/home/thockin/src/kubernetes/docs/services-userspace-overview.png" inkscape:export-xdpi="76.910004" inkscape:export-ydpi="76.910004" inkscape:version="0.48.4 r9939" sodipodi:docname="services-iptables-overview.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 656 486"
|
||||
style="enable-background:new 0 0 656 486;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#000000;stroke-width:0.8425;}
|
||||
.st1{fill:none;stroke:#000000;stroke-width:2.0786;}
|
||||
.st2{stroke:#000000;stroke-width:2.0786;stroke-linecap:round;}
|
||||
.st3{fill:none;stroke:#000000;stroke-width:5;}
|
||||
.st4{stroke:#000000;stroke-width:4.7036;stroke-linecap:round;}
|
||||
.st5{fill:none;stroke:#000000;stroke-width:4.2928;}
|
||||
.st6{stroke:#000000;stroke-width:4.2928;stroke-linecap:round;}
|
||||
.st7{fill:#85BFF1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st8{font-family:'ArialMT';}
|
||||
.st9{font-size:32px;}
|
||||
.st10{font-size:24px;}
|
||||
.st11{fill:none;stroke:#000000;stroke-width:5.1965;}
|
||||
.st12{stroke:#000000;stroke-width:5.1965;stroke-linecap:round;}
|
||||
.st13{fill:#F1CB85;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st14{fill:#B9F185;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st15{fill:#EDC1F8;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st16{fill:#FFE680;stroke:#000000;stroke-width:1.7787;}
|
||||
.st17{font-family:'MyriadPro-Regular';}
|
||||
.st18{font-size:40px;}
|
||||
</style>
|
||||
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="115.9218" inkscape:cy="392.30545" inkscape:document-units="px" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="822" inkscape:window-maximized="0" inkscape:window-width="1552" inkscape:window-x="203" inkscape:window-y="50" inkscape:zoom="1.0318369" pagecolor="#ffffff" showgrid="false">
|
||||
</sodipodi:namedview>
|
||||
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
|
||||
<rect id="rect3115" x="104.3" y="72.5" class="st0" width="545.8" height="253.1"/>
|
||||
<g id="g4178-3-0" transform="matrix(1,0,0,-0.92578962,15.303948,1193.1996)">
|
||||
<path id="path4174-3-7" inkscape:connector-curvature="0" class="st1" d="M485.1,1264.5c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-1" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st2" d="
|
||||
M476.8,1202.5l8.7-15l8.7,15H476.8z"/>
|
||||
</g>
|
||||
|
||||
<g id="g4178-3-8" transform="matrix(-0.83212211,-1.1231515,0.89570092,-0.89430772,-72.942206,1678.3161)" inkscape:transform-center-x="84.098741" inkscape:transform-center-y="1.4572787e-05">
|
||||
<path id="path4174-3-4" inkscape:connector-curvature="0" class="st1" d="M501.5,1075.9c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-0" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st2" d="
|
||||
M493.2,1013.9l8.7-15l8.7,15L493.2,1013.9z"/>
|
||||
</g>
|
||||
<g id="g4324" transform="matrix(0.96592583,0.25881905,0.25881905,-0.96592583,-272.81074,1126.238)">
|
||||
<path id="path4174-3-2" inkscape:connector-curvature="0" class="st3" d="M362,988.4C260,874.6,260,874.6,260,874.6"/>
|
||||
|
||||
<path id="path4176-9-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st4" d="
|
||||
M253,881.5l-4.8-18.4l17.8,6.9L253,881.5z"/>
|
||||
</g>
|
||||
<g id="g4324-8" transform="matrix(-0.96592583,0.25881905,-0.25881905,-0.96592583,654.32964,1126.238)">
|
||||
<path id="path4174-3-2-7" inkscape:connector-curvature="0" class="st3" d="M76.1,911.8C-25.9,798-25.9,798-25.9,798"/>
|
||||
|
||||
<path id="path4176-9-9-3" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st4" d="
|
||||
M-32.9,804.9l-4.8-18.4l17.8,6.9L-32.9,804.9z"/>
|
||||
</g>
|
||||
<g id="g4178-3-9" transform="matrix(1,0,0,-1.3566066,-154.75999,1749.5431)">
|
||||
<path id="path4174-3-8" inkscape:connector-curvature="0" class="st5" d="M485.1,1103.7c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-5" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st6" d="
|
||||
M476.8,1041.6l8.7-15l8.7,15H476.8z"/>
|
||||
</g>
|
||||
<g id="g3937" transform="translate(-212.35646,769.73074)">
|
||||
<g id="g3868" transform="matrix(0.88792337,0,0,1,43.50975,6.5250001e-6)">
|
||||
<rect id="rect2985" x="196.7" y="-408.1" class="st7" width="224.3" height="118.6"/>
|
||||
<g id="g3861">
|
||||
<text transform="matrix(1 0 0 1 203.3918 -377.1545)" class="st8 st9">Backend Pod 1</text>
|
||||
<text transform="matrix(1 0 0 1 203.824 -338.0667)" class="st8 st10">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 203.824 -308.0667)" class="st8 st10">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-7" transform="matrix(0.88792337,0,0,1,262.00231,6.5250001e-6)">
|
||||
<rect id="rect2985-1" x="196.7" y="-408.1" class="st7" width="224.3" height="118.6"/>
|
||||
<g id="g3861-9">
|
||||
<text transform="matrix(1 0 0 1 203.3919 -377.1545)" class="st8 st9">Backend Pod 2</text>
|
||||
<text transform="matrix(1 0 0 1 203.8241 -338.0667)" class="st8 st10">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 203.8241 -308.0667)" class="st8 st10">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-3" transform="matrix(0.88792337,0,0,1,480.49489,6.5250001e-6)">
|
||||
<rect id="rect2985-2" x="196.7" y="-408.1" class="st7" width="224.3" height="118.6"/>
|
||||
<g id="g3861-3">
|
||||
<text transform="matrix(1 0 0 1 203.392 -377.1545)" class="st8 st9">Backend Pod 3</text>
|
||||
<text transform="matrix(1 0 0 1 203.8237 -338.0667)" class="st8 st10">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 203.8237 -308.0667)" class="st8 st10">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4178-3" transform="matrix(0.91192623,-0.41035418,-0.37990164,-0.84425184,113.60453,1385.4009)">
|
||||
<path id="path4174-3" inkscape:connector-curvature="0" class="st11" d="M664.6,1154.3c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st12" d="
|
||||
M656.2,1092.3l8.7-15l8.7,15H656.2z"/>
|
||||
</g>
|
||||
<g id="g4090" transform="matrix(0.89067003,0,0,1,-194.97295,-142.36286)">
|
||||
<rect id="rect2985-4" x="388" y="235.5" class="st13" width="224.3" height="58.6"/>
|
||||
<g id="g3861-6" transform="translate(217.6177,652.82516)">
|
||||
<text transform="matrix(1 0 0 1 233.7419 -377.2347)" class="st8 st9">Client </text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168" transform="matrix(0.89067003,0,0,1,199.65922,-24.251798)">
|
||||
<rect id="rect2985-4-0" x="216.9" y="119.8" class="st14" width="250" height="58.6"/>
|
||||
<g id="g3861-6-2" transform="translate(34.747433,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 226.622 -376.7865)" class="st8 st9">kube-proxy</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168-5" transform="translate(188.04333,-29.041887)">
|
||||
<g id="g4238" transform="translate(22.087429,-86.34177)">
|
||||
<rect id="rect2985-4-0-6" x="199.9" y="119.8" class="st15" width="191.8" height="58.6"/>
|
||||
<g id="g3861-6-2-6" transform="translate(39.107429,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 184.7109 -377.1544)" class="st8 st9">apiserver</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<path id="path3884" inkscape:connector-curvature="0" class="st16" d="M332.5,202c-14.5,0-27,8.6-33,21.2c-5-0.9-10.3-1.4-15.8-1.4
|
||||
c-34.3,0-62.2,19.1-62.2,42.6s27.8,42.6,62.2,42.6c16.9,0,32.2-4.6,43.4-12.2c7.4,16.3,34,28.3,65.7,28.3
|
||||
c33.5,0,61.4-13.4,66.8-31.1c17-5.3,28.6-15.7,28.6-27.7c0-17.3-24.4-31.4-54.4-31.4c-8.5,0-16.5,1.1-23.6,3.1
|
||||
c-2-10.5-14.8-18.6-30.3-18.6c-5.8,0-11.2,1.2-15.9,3.1C357.7,209.5,345.9,202,332.5,202L332.5,202z"/>
|
||||
<g id="g3861-6-28" transform="matrix(0.89067003,0,0,1,34.810052,629.61733)">
|
||||
<text transform="matrix(1 0 0 1 259.8564 -379.173)" class="st8 st9">clusterIP</text>
|
||||
<text transform="matrix(1 0 0 1 259.8564 -339.173)" class="st8 st9">(iptables) </text>
|
||||
</g>
|
||||
<text transform="matrix(1 0 0 1 537.5965 317.8163)" class="st17 st18">Node</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1"
|
||||
id="svg2" inkscape:export-filename="/usr/local/google/home/thockin/src/kubernetes/docs/services-ipvs-overview.png" inkscape:export-xdpi="76.910004" inkscape:export-ydpi="76.910004" inkscape:version="0.48.4 r9939" sodipodi:docname="services-ipvs-overview.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 656 486"
|
||||
style="enable-background:new 0 0 656 486;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#000000;stroke-width:0.8425;}
|
||||
.st1{fill:none;stroke:#000000;stroke-width:2.0786;}
|
||||
.st2{stroke:#000000;stroke-width:2.0786;stroke-linecap:round;}
|
||||
.st3{fill:none;stroke:#000000;stroke-width:5;}
|
||||
.st4{stroke:#000000;stroke-width:4.7036;stroke-linecap:round;}
|
||||
.st5{fill:none;stroke:#000000;stroke-width:4.2928;}
|
||||
.st6{stroke:#000000;stroke-width:4.2928;stroke-linecap:round;}
|
||||
.st7{fill:#85BFF1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st8{font-family:'ArialMT';}
|
||||
.st9{font-size:32px;}
|
||||
.st10{font-size:24px;}
|
||||
.st11{fill:none;stroke:#000000;stroke-width:5.1965;}
|
||||
.st12{stroke:#000000;stroke-width:5.1965;stroke-linecap:round;}
|
||||
.st13{fill:#F1CB85;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st14{fill:#B9F185;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st15{fill:#EDC1F8;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st16{fill:#FFE680;stroke:#000000;stroke-width:1.7787;}
|
||||
.st17{font-family:'MyriadPro-Regular';}
|
||||
.st18{font-size:40px;}
|
||||
</style>
|
||||
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="115.9218" inkscape:cy="392.30545" inkscape:document-units="px" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="822" inkscape:window-maximized="0" inkscape:window-width="1552" inkscape:window-x="203" inkscape:window-y="50" inkscape:zoom="1.0318369" pagecolor="#ffffff" showgrid="false">
|
||||
</sodipodi:namedview>
|
||||
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
|
||||
<rect id="rect3116" height="105.80995" width="645.257723" class="st0" y="350.381592" x="5 .318098"/>
|
||||
<rect id="rect3115" x="104.3" y="72.5" class="st0" width="545.8" height="253.1"/>
|
||||
<g id="g4178-3-0" transform="matrix(1,0,0,-0.92578962,15.303948,1193.1996)">
|
||||
<path id="path4174-3-7" inkscape:connector-curvature="0" class="st1" d="M485.1,1264.5c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-1" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st2" d="
|
||||
M476.8,1202.5l8.7-15l8.7,15H476.8z"/>
|
||||
</g>
|
||||
|
||||
<g id="g4178-3-8" transform="matrix(-0.83212211,-1.1231515,0.89570092,-0.89430772,-72.942206,1678.3161)" inkscape:transform-center-x="84.098741" inkscape:transform-center-y="1.4572787e-05">
|
||||
<path id="path4174-3-4" inkscape:connector-curvature="0" class="st1" d="M501.5,1075.9c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-0" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st2" d="
|
||||
M493.2,1013.9l8.7-15l8.7,15L493.2,1013.9z"/>
|
||||
</g>
|
||||
<g id="g4324" transform="matrix(0.96592583,0.25881905,0.25881905,-0.96592583,-272.81074,1126.238)">
|
||||
<path id="path4174-3-2" inkscape:connector-curvature="0" class="st3" d="M362,988.4C260,874.6,260,874.6,260,874.6"/>
|
||||
|
||||
<path id="path4176-9-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st4" d="
|
||||
M253,881.5l-4.8-18.4l17.8,6.9L253,881.5z"/>
|
||||
</g>
|
||||
<g id="g4324-8" transform="matrix(-0.96592583,0.25881905,-0.25881905,-0.96592583,654.32964,1126.238)">
|
||||
<path id="path4174-3-2-7" inkscape:connector-curvature="0" class="st3" d="M76.1,911.8C-25.9,798-25.9,798-25.9,798"/>
|
||||
|
||||
<path id="path4176-9-9-3" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st4" d="
|
||||
M-32.9,804.9l-4.8-18.4l17.8,6.9L-32.9,804.9z"/>
|
||||
</g>
|
||||
<g id="g4178-3-9" transform="matrix(1,0,0,-1.3566066,-154.75999,1749.5431)">
|
||||
<path id="path4174-3-8" inkscape:connector-curvature="0" class="st5" d="M485.1,1103.7c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-5" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st6" d="
|
||||
M476.8,1041.6l8.7-15l8.7,15H476.8z"/>
|
||||
</g>
|
||||
<g id="g3937" transform="translate(-212.35646,769.73074)">
|
||||
<g id="g3868" transform="matrix(0.88792337,0,0,1,43.50975,6.5250001e-6)">
|
||||
<rect id="rect2985" x="196.7" y="-408.1" class="st7" width="224.3" height="50"/>
|
||||
<g id="g3861">
|
||||
<text transform="matrix(1 0 0 1 203.3918 -377.1545)" class="st8 st9">Backend Pod 1</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-7" transform="matrix(0.88792337,0,0,1,262.00231,6.5250001e-6)">
|
||||
<rect id="rect2985-1" x="196.7" y="-408.1" class="st7" width="224.3" height="50"/>
|
||||
<g id="g3861-9">
|
||||
<text transform="matrix(1 0 0 1 203.3919 -377.1545)" class="st8 st9">Backend Pod 2</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-3" transform="matrix(0.88792337,0,0,1,480.49489,6.5250001e-6)">
|
||||
<rect id="rect2985-2" x="196.7" y="-408.1" class="st7" width="224.3" height="50"/>
|
||||
<g id="g3861-3">
|
||||
<text transform="matrix(1 0 0 1 203.392 -377.1545)" class="st8 st9">Backend Pod 3</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4178-3" transform="matrix(0.91192623,-0.41035418,-0.37990164,-0.84425184,113.60453,1385.4009)">
|
||||
<path id="path4174-3" inkscape:connector-curvature="0" class="st11" d="M664.6,1154.3c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st12" d="
|
||||
M656.2,1092.3l8.7-15l8.7,15H656.2z"/>
|
||||
</g>
|
||||
<g id="g4090" transform="matrix(0.89067003,0,0,1,-194.97295,-142.36286)">
|
||||
<rect id="rect2985-4" x="388" y="235.5" class="st13" width="224.3" height="58.6"/>
|
||||
<g id="g3861-6" transform="translate(217.6177,652.82516)">
|
||||
<text transform="matrix(1 0 0 1 233.7419 -377.2347)" class="st8 st9">Client </text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168" transform="matrix(0.89067003,0,0,1,199.65922,-24.251798)">
|
||||
<rect id="rect2985-4-0" x="216.9" y="119.8" class="st14" width="250" height="58.6"/>
|
||||
<g id="g3861-6-2" transform="translate(34.747433,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 226.622 -376.7865)" class="st8 st9">kube-proxy</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168-5" transform="translate(188.04333,-29.041887)">
|
||||
<g id="g4238" transform="translate(22.087429,-86.34177)">
|
||||
<rect id="rect2985-4-0-6" x="199.9" y="119.8" class="st15" width="191.8" height="58.6"/>
|
||||
<g id="g3861-6-2-6" transform="translate(39.107429,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 184.7109 -377.1544)" class="st8 st9">apiserver</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<path id="path3884" inkscape:connector-curvature="0" class="st16" d="M332.5,202c-14.5,0-27,8.6-33,21.2c-5-0.9-10.3-1.4-15.8-1.4
|
||||
c-34.3,0-62.2,19.1-62.2,42.6s27.8,42.6,62.2,42.6c16.9,0,32.2-4.6,43.4-12.2c7.4,16.3,34,28.3,65.7,28.3
|
||||
c33.5,0,61.4-13.4,66.8-31.1c17-5.3,28.6-15.7,28.6-27.7c0-17.3-24.4-31.4-54.4-31.4c-8.5,0-16.5,1.1-23.6,3.1
|
||||
c-2-10.5-14.8-18.6-30.3-18.6c-5.8,0-11.2,1.2-15.9,3.1C357.7,209.5,345.9,202,332.5,202L332.5,202z"/>
|
||||
<g id="g3861-6-28" transform="matrix(0.89067003,0,0,1,34.810052,629.61733)">
|
||||
<text transform="matrix(1 0 0 1 259.8564 -379.173)" class="st8 st9">clusterIP</text>
|
||||
<text transform="matrix(1 0 0 1 240.8564 -339.173)" class="st8 st9" fill="red">(Virtual Server) </text>
|
||||
</g>
|
||||
<text transform="matrix(1 0 0 1 537.5965 317.8163)" class="st17 st18">Node</text>
|
||||
<text transform="matrix(1 0 0 1 230 450)" class="st8 st9" fill="red">(Real Server) </text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.0 KiB |
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1"
|
||||
id="svg2" inkscape:export-filename="/usr/local/google/home/thockin/src/kubernetes/docs/services_overview.png" inkscape:export-xdpi="76.910004" inkscape:export-ydpi="76.910004" inkscape:version="0.48.4 r9939" sodipodi:docname="services-userspace-overview.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 763 429"
|
||||
style="enable-background:new 0 0 763 429;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#000000;stroke-width:5.1965;}
|
||||
.st1{stroke:#000000;stroke-width:5.1965;stroke-linecap:round;}
|
||||
.st2{fill:none;stroke:#000000;stroke-width:5;}
|
||||
.st3{stroke:#000000;stroke-width:4.7036;stroke-linecap:round;}
|
||||
.st4{fill:none;stroke:#000000;stroke-width:4.2928;}
|
||||
.st5{stroke:#000000;stroke-width:4.2928;stroke-linecap:round;}
|
||||
.st6{fill:#85BFF1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st7{font-family:'ArialMT';}
|
||||
.st8{font-size:32px;}
|
||||
.st9{font-size:24px;}
|
||||
.st10{fill:none;stroke:#000000;stroke-width:1.8814;}
|
||||
.st11{stroke:#000000;stroke-width:1.8814;stroke-linecap:round;}
|
||||
.st12{fill:#F1CB85;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st13{fill:#B9F185;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st14{fill:#EDC1F8;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
|
||||
.st15{fill:#FFE680;stroke:#000000;stroke-width:1.7787;}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:0.9239;}
|
||||
.st17{font-family:'MyriadPro-Regular';}
|
||||
.st18{font-size:40px;}
|
||||
</style>
|
||||
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="291.9254" inkscape:cy="392.30545" inkscape:document-units="px" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="822" inkscape:window-maximized="0" inkscape:window-width="1552" inkscape:window-x="46" inkscape:window-y="47" inkscape:zoom="1.0318369" pagecolor="#ffffff" showgrid="false">
|
||||
</sodipodi:namedview>
|
||||
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
|
||||
<g id="g4178-3-8" transform="matrix(0,-1,-0.92578962,0,936.44413,1029.2686)">
|
||||
<path id="path4174-3-4" inkscape:connector-curvature="0" class="st0" d="M813.1,746.1c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-0" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st1" d="
|
||||
M804.8,684.1l8.7-15l8.7,15H804.8z"/>
|
||||
</g>
|
||||
<g id="g4324" transform="matrix(0.96592583,0.25881905,0.25881905,-0.96592583,-38.810744,1076.238)">
|
||||
<path id="path4174-3-2" inkscape:connector-curvature="0" class="st2" d="M227.9,959.7c-102-113.8-102-113.8-102-113.8"/>
|
||||
|
||||
<path id="path4176-9-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st3" d="
|
||||
M118.8,852.8l-4.8-18.4l17.8,6.9L118.8,852.8z"/>
|
||||
</g>
|
||||
<g id="g4324-8" transform="matrix(-0.96592583,0.25881905,-0.25881905,-0.96592583,888.32964,1076.238)">
|
||||
<path id="path4174-3-2-7" inkscape:connector-curvature="0" class="st2" d="M206.6,954c-102-113.8-102-113.8-102-113.8"/>
|
||||
|
||||
<path id="path4176-9-9-3" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st3" d="
|
||||
M97.6,847.1l-4.8-18.4l17.8,6.9L97.6,847.1z"/>
|
||||
</g>
|
||||
<g id="g4178-3-9" transform="matrix(1,0,0,-1.3566066,79.240014,1699.5431)">
|
||||
<path id="path4174-3-8" inkscape:connector-curvature="0" class="st4" d="M348.1,1108.8c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-5" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st5" d="
|
||||
M339.8,1046.8l8.7-15l8.7,15H339.8z"/>
|
||||
</g>
|
||||
<g id="g3937" transform="translate(21.643544,719.73074)">
|
||||
<g id="g3868" transform="matrix(0.88792337,0,0,1,43.50975,6.5250001e-6)">
|
||||
<rect id="rect2985" x="42.4" y="-415.1" class="st6" width="224.3" height="118.6"/>
|
||||
<g id="g3861">
|
||||
<text transform="matrix(1 0 0 1 49.0991 -384.1545)" class="st7 st8">Backend Pod 1</text>
|
||||
<text transform="matrix(1 0 0 1 49.5313 -345.0667)" class="st7 st9">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 49.5313 -315.0667)" class="st7 st9">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-7" transform="matrix(0.88792337,0,0,1,262.00231,6.5250001e-6)">
|
||||
<rect id="rect2985-1" x="42.4" y="-415.1" class="st6" width="224.3" height="118.6"/>
|
||||
<g id="g3861-9">
|
||||
<text transform="matrix(1 0 0 1 49.0992 -384.1545)" class="st7 st8">Backend Pod 2</text>
|
||||
<text transform="matrix(1 0 0 1 49.5315 -345.0667)" class="st7 st9">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 49.5315 -315.0667)" class="st7 st9">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g3868-3" transform="matrix(0.88792337,0,0,1,480.49489,6.5250001e-6)">
|
||||
<rect id="rect2985-2" x="42.4" y="-415.1" class="st6" width="224.3" height="118.6"/>
|
||||
<g id="g3861-3">
|
||||
<text transform="matrix(1 0 0 1 49.0988 -384.1545)" class="st7 st8">Backend Pod 3</text>
|
||||
<text transform="matrix(1 0 0 1 49.531 -345.0667)" class="st7 st9">labels: app=MyApp</text>
|
||||
<text transform="matrix(1 0 0 1 49.531 -315.0667)" class="st7 st9">port: 9376</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4178-3-4" transform="matrix(-0.8305249,-0.5569815,0.62939332,-0.93849945,365.54855,1487.8396)">
|
||||
<path id="path4174-3-9" inkscape:connector-curvature="0" class="st10" d="M593.1,1113.2c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9-1" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st11" d="
|
||||
M584.8,1051.2l8.7-15l8.7,15L584.8,1051.2z"/>
|
||||
</g>
|
||||
<g id="g4178-3" transform="matrix(1,0,0,-0.92578962,-170.98136,1268.7699)">
|
||||
<path id="path4174-3" inkscape:connector-curvature="0" class="st0" d="M348.1,1272.1c0-71.3,0-71.3,0-71.3"/>
|
||||
|
||||
<path id="path4176-9" inkscape:flatsided="true" inkscape:randomized="0" inkscape:rounded="0" inkscape:transform-center-y="-2.5" sodipodi:arg1="2.6179939" sodipodi:arg2="3.6651914" sodipodi:cx="308.85715" sodipodi:cy="753.79077" sodipodi:r1="10" sodipodi:r2="5" sodipodi:sides="3" sodipodi:type="star" class="st1" d="
|
||||
M339.8,1210.1l8.7-15l8.7,15H339.8z"/>
|
||||
</g>
|
||||
<g id="g4090" transform="matrix(0.89067003,0,0,1,-130.97295,-172.36286)">
|
||||
<rect id="rect2985-4" x="234.1" y="228.5" class="st12" width="224.3" height="58.6"/>
|
||||
<g id="g3861-6" transform="translate(217.6177,652.82516)">
|
||||
<text transform="matrix(1 0 0 1 79.9251 -384.2347)" class="st7 st8">Client </text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168" transform="matrix(0.89067003,0,0,1,263.65922,74.205473)">
|
||||
<rect id="rect2985-4-0" x="63.1" y="112.8" class="st13" width="250" height="58.6"/>
|
||||
<g id="g3861-6-2" transform="translate(34.747433,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 72.8052 -383.7867)" class="st7 st8">kube-proxy</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="g4168-5" transform="translate(478.82336,27.291965)">
|
||||
<g id="g4238" transform="translate(22.087429,-86.34177)">
|
||||
<rect id="rect2985-4-0-6" x="62.9" y="112.8" class="st14" width="191.8" height="58.6"/>
|
||||
<g id="g3861-6-2-6" transform="translate(39.107429,534.26287)">
|
||||
<text transform="matrix(1 0 0 1 47.7108 -384.1544)" class="st7 st8">apiserver</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<path id="path3884" inkscape:connector-curvature="0" class="st15" d="M129.6,153.1c-14.5,0-27,8.6-33,21.2
|
||||
c-5-0.9-10.3-1.4-15.8-1.4c-34.3,0-62.2,19.1-62.2,42.6s27.8,42.6,62.2,42.6c16.9,0,32.2-4.6,43.4-12.2c7.4,16.3,34,28.3,65.7,28.3
|
||||
c33.5,0,61.4-13.4,66.8-31.1c17-5.3,28.6-15.7,28.6-27.7c0-17.3-24.4-31.4-54.4-31.4c-8.5,0-16.5,1.1-23.6,3.1
|
||||
c-2-10.5-14.8-18.6-30.3-18.6c-5.8,0-11.2,1.2-15.9,3.1C154.8,160.6,143,153.1,129.6,153.1L129.6,153.1z"/>
|
||||
<g id="g3861-6-28" transform="matrix(0.89067003,0,0,1,-31.091836,587.67904)">
|
||||
<text transform="matrix(1 0 0 1 106.0396 -386.1732)" class="st7 st8">clusterIP</text>
|
||||
<text transform="matrix(1 0 0 1 106.0396 -346.1732)" class="st7 st8">(iptables) </text>
|
||||
</g>
|
||||
<rect id="rect3889" x="7.1" y="8.4" class="st16" width="544.7" height="267.6"/>
|
||||
<text transform="matrix(1 0 0 1 11.9691 45.2705)" class="st17 st18">Node</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
@@ -90,22 +90,223 @@ subsets:
|
||||
|
||||
ExternalName Service 是一类特殊的没有 label selector 的 Service,该类 Service 使用 DNS 名字。参考 [ExternalName](#externalname)
|
||||
|
||||
## 虚拟 IP 和服务代理
|
||||
|
||||
An ExternalName Service is a special case of Service that does not have selectors and uses DNS names instead. For more information, see the ExternalName section later in this document
|
||||
Kubernetes 集群中的每个节点都运行了一个 `kube-proxy`,负责为 Service(ExternalName 类型的除外)提供虚拟 IP 访问。
|
||||
|
||||
## 虚拟 IP 和 Service proxy
|
||||
### 为何不使用 round-robin DNS
|
||||
|
||||
正在撰写,最后更新时间:2019年9月17日 22:55
|
||||
许多用户都对 Kubernetes 为何使用服务代理将接收到的请求转发给后端服务,而不是使用其他途径,例如:是否可以为 Service 配置一个 DNS 记录,将其解析到多个 A value(如果是 IPv6 则是 AAAA value),并依赖 round-robin(循环)解析?
|
||||
|
||||
Kubernetes 使用在 Service 中使用 proxy 的原因大致有如下几个:
|
||||
* 一直以来,DNS 软件都不确保严格检查 TTL(Time to live),并且在缓存的 dns 解析结果应该过期以后,仍然继续使用缓存中的记录
|
||||
* 某些应用程序只做一次 DNS 解析,并一直使用缓存下来的解析结果
|
||||
* 即使应用程序对 DNS 解析做了合适的处理,为 DNS 记录设置过短(或者 0)的 TTL 值,将给 DNS 服务器带来过大的负载
|
||||
|
||||
### 版本兼容性
|
||||
|
||||
Kubernetes 支持三种 proxy mode(代理模式),他们的版本兼容性如下:
|
||||
|
||||
| 代理模式 | Kubernetes 版本 | 是否默认 |
|
||||
| --------------------- | --------------- | -------- |
|
||||
| User space proxy mode | v1.0 + | |
|
||||
| Iptables proxy mode | v1.1 + | 默认 |
|
||||
| Ipvs proxy mode | v1.8 + | |
|
||||
|
||||
### User space 代理模式
|
||||
|
||||
**在 user space proxy mode 下:**
|
||||
|
||||
* kube-proxy 监听 kubernetes master 以获得添加和移除 Service / Endpoint 的事件
|
||||
* kube-proxy 在其所在的节点(每个节点都有 kube-proxy)上为每一个 Service 打开一个随机端口
|
||||
* kube-proxy 安装 iptables 规则,将发送到该 Service 的 ClusterIP(虚拟 IP)/ Port 的请求重定向到该随机端口
|
||||
* 任何发送到该随机端口的请求将被代理转发到该 Service 的后端 Pod 上(kube-proxy 从 Endpoint 信息中获得可用 Pod)
|
||||
* kube-proxy 在决定将请求转发到后端哪一个 Pod 时,默认使用 round-robin(轮询)算法,并会考虑到 Service 中的 `SessionAffinity` 的设定
|
||||
|
||||
如下图所示:
|
||||
|
||||
<p>
|
||||
<img src="./service-details.assets/services-userspace-overview.svg" style="max-width: 420px;"/>
|
||||
</p>
|
||||
|
||||
### Iptables 代理模式 <Badge text="默认模式" type="success"/>
|
||||
|
||||
**在 iptables proxy mode 下:**
|
||||
|
||||
* kube-proxy 监听 kubernetes master 以获得添加和移除 Service / Endpoint 的事件
|
||||
* kube-proxy 在其所在的节点(每个节点都有 kube-proxy)上为每一个 Service 安装 iptable 规则
|
||||
* iptables 将发送到 Service 的 ClusterIP / Port 的请求重定向到 Service 的后端 Pod 上
|
||||
* 对于 Service 中的每一个 Endpoint,kube-proxy 安装一个 iptable 规则
|
||||
* 默认情况下,kube-proxy 随机选择一个 Service 的后端 Pod
|
||||
|
||||
如下图所示:
|
||||
<p>
|
||||
<img src="./service-details.assets/services-iptables-overview.svg" style="max-width: 420px;"/>
|
||||
</p>
|
||||
|
||||
**iptables proxy mode 的优点:**
|
||||
|
||||
* 更低的系统开销:在 linux netfilter 处理请求,无需在 userspace 和 kernel space 之间切换
|
||||
* 更稳定
|
||||
|
||||
**与 user space mode 的差异:**
|
||||
|
||||
* 使用 iptables mode 时,如果第一个 Pod 没有响应,则创建连接失败
|
||||
* 使用 user space mode 时,如果第一个 Pod 没有响应,kube-proxy 会自动尝试连接另外一个后端 Pod
|
||||
|
||||
您可以配置 Pod 就绪检查(readiness probe)确保后端 Pod 正常工作,此时,在 iptables 模式下 kube-proxy 将只使用健康的后端 Pod,从而避免了 kube-proxy 将请求转发到已经存在问题的 Pod 上。
|
||||
|
||||
### IPVS 代理模式
|
||||
|
||||
**在 IPVS proxy mode 下:**
|
||||
|
||||
* kube-proxy 监听 kubernetes master 以获得添加和移除 Service / Endpoint 的事件
|
||||
* kube-proxy 根据监听到的事件,调用 netlink 接口,创建 IPVS 规则;并且将 Service/Endpoint 的变化同步到 IPVS 规则中
|
||||
* 当访问一个 Service 时,IPVS 将请求重定向到后端 Pod
|
||||
|
||||
<p>
|
||||
<img src="./service-details.assets/services-ipvs-overview.svg" style="max-width: 420px;"/>
|
||||
</p>
|
||||
|
||||
**IPVS 模式的优点**
|
||||
|
||||
IPVS proxy mode 基于 netfilter 的 hook 功能,与 iptables 代理模式相似,但是 IPVS 代理模式使用 hash table 作为底层的数据结构,并在 kernel space 运作。这就意味着
|
||||
* IPVS 代理模式可以比 iptables 代理模式有更低的网络延迟,在同步代理规则时,也有更高的效率
|
||||
* 与 user space 代理模式 / iptables 代理模式相比,IPVS 模式可以支持更大的网络流量
|
||||
|
||||
**IPVS 提供更多的负载均衡选项:**
|
||||
* rr: round-robin
|
||||
* lc: least connection (最小打开的连接数)
|
||||
* dh: destination hashing
|
||||
* sh: source hashing
|
||||
* sed: shortest expected delay
|
||||
* nq: never queue
|
||||
|
||||
::: tip
|
||||
* 如果要使用 IPVS 模式,您必须在启动 kube-proxy 前为节点的 linux 启用 IPVS
|
||||
* kube-proxy 以 IPVS 模式启动时,如果发现节点的 linux 未启用 IPVS,则退回到 iptables 模式
|
||||
:::
|
||||
|
||||
### 代理模式总结
|
||||
|
||||
在所有的代理模式中,发送到 Service 的 IP:Port 的请求将被转发到一个合适的后端 Pod,而无需调用者知道任何关于 Kubernetes/Service/Pods 的细节。
|
||||
|
||||
Service 中额外字段的作用:
|
||||
* `service.spec.sessionAffinity`
|
||||
* 默认值为 "None"
|
||||
* 如果设定为 "ClientIP",则同一个客户端的连接将始终被转发到同一个 Pod
|
||||
* `service.spec.sessionAffinityConfig.clientIP.timeoutSeconds`
|
||||
* 默认值为 10800 (3 小时)
|
||||
* 设定会话保持的持续时间
|
||||
|
||||
## 多端口的Service
|
||||
|
||||
Kubernetes 中,您可以在一个 Service 对象中定义多个端口,此时,您必须为每个端口定义一个名字。如下所示:
|
||||
|
||||
``` yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-service
|
||||
spec:
|
||||
selector:
|
||||
app: MyApp
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: 9377
|
||||
```
|
||||
|
||||
::: tip
|
||||
端口的名字必须符合 Kubernetes 的命名规则,且,端口的名字只能包含小写字母、数字、`-`,并且必须以数字或字母作为开头及结尾。
|
||||
|
||||
例如:
|
||||
|
||||
合法的 Port 名称:`123-abc`、`web`
|
||||
|
||||
非法的 Port 名称:`123_abc`、`-web`
|
||||
:::
|
||||
|
||||
## 使用自定义的 IP 地址 <Badge text="Kuboard 正在计划中" type="warn"/>
|
||||
|
||||
创建 Service 时,如果指定 `.spec.clusterIP` 字段,可以使用自定义的 Cluster IP 地址。该 IP 地址必须是 APIServer 中配置字段 `service-cluster-ip-range` CIDR 范围内的合法 IPv4 或 IPv6 地址,否则不能创建成功。
|
||||
|
||||
可能用到自定义 IP 地址的场景:
|
||||
* 想要重用某个已经存在的 DNS 条目
|
||||
* 遗留系统是通过 IP 地址寻址,且很难改造
|
||||
|
||||
## 服务发现
|
||||
|
||||
Kubernetes 支持两种主要的服务发现模式:
|
||||
* 环境变量
|
||||
* DNS
|
||||
|
||||
### 环境变量
|
||||
|
||||
kubelet 查找有效的 Service,并针对每一个 Service,向其所在节点上的 Pod 注入一组环境变量。支持的环境变量有:
|
||||
* [Docker links 兼容](https://docs.docker.com/network/links/) 的环境变量
|
||||
* {SVCNAME}_SERVICE_HOST 和 {SVCNAME}_SERVICE_PORT
|
||||
* Service name 被转换为大写
|
||||
* 小数点 `.` 被转换为下划线 `_`
|
||||
|
||||
例如,Service `redis-master` 暴露 TCP 端口 6379,其 Cluster IP 为 10.0.0.11,对应的环境变量如下所示:
|
||||
|
||||
``` s
|
||||
REDIS_MASTER_SERVICE_HOST=10.0.0.11
|
||||
REDIS_MASTER_SERVICE_PORT=6379
|
||||
REDIS_MASTER_PORT=tcp://10.0.0.11:6379
|
||||
REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.11:6379
|
||||
REDIS_MASTER_PORT_6379_TCP_PROTO=tcp
|
||||
REDIS_MASTER_PORT_6379_TCP_PORT=6379
|
||||
REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.11
|
||||
```
|
||||
|
||||
::: tip
|
||||
如果要在 Pod 中使用基于环境变量的服务发现方式,必须先创建 Service,再创建调用 Service 的 Pod。否则,Pod 中不会有该 Service 对应的环境变量。
|
||||
|
||||
如果使用基于 DNS 的服务发现,您无需担心这个创建顺序的问题
|
||||
:::
|
||||
|
||||
### DNS
|
||||
|
||||
如果按照 www.kuboard.cn 上的文档安装 Kubernetes,默认已经安装了 DNS 服务,[Core DNS](https://coredns.io/)。
|
||||
|
||||
CoreDNS 监听 Kubernetes API 上创建和删除 Service 的事件,并为每一个 Service 创建一条 DNS 记录。集群中所有的 Pod 都可以使用 DNS Name 解析到 Service 的 IP 地址。
|
||||
|
||||
例如,名称空间 `my-ns` 中的 Service `my-service`,将对应一条 DNS 记录 `my-service.my-ns`。 名称空间 `my-ns` 中的Pod可以直接 `nslookup my-service` (`my-service.my-ns` 也可以)。其他名称空间的 Pod 必须使用 `my-service.my-ns`。`my-service` 和 `my-service.my-ns` 都将被解析到 Service 的 Cluster IP。
|
||||
|
||||
Kubernetes 同样支持 DNS SRV(Service)记录,用于查找一个命名的端口。假设 `my-service.my-ns` Service 有一个 TCP 端口名为 `http`,则,您可以 `nslookup _http._tcp.my-service.my-ns` 以发现该Service 的 IP 地址及端口 `http`
|
||||
|
||||
对于 `ExternalName` 类型的 Service,只能通过 DNS 的方式进行服务发现。参考 [Service/Pod 的 DNS](./dns.html)
|
||||
|
||||
## Headless Services
|
||||
|
||||
“Headless” Service 不提供负载均衡的特性,也没有自己的 IP 地址。创建 “headless” Service 时,只需要指定 `.spec.clusterIP` 为 "None"。
|
||||
|
||||
“Headless” Service 可以用于对接其他形式的服务发现机制,而无需与 Kubernetes 的实现绑定。
|
||||
|
||||
对于 “Headless” Service 而言:
|
||||
* 没有 Cluster IP
|
||||
* kube-proxy 不处理这类 Service
|
||||
* Kubernetes不提供负载均衡或代理支持
|
||||
|
||||
DNS 的配置方式取决于该 Service 是否配置了 selector:
|
||||
|
||||
* 配置了 Selector
|
||||
|
||||
Endpoints Controller 创建 `Endpoints` 记录,并修改 DNS 配置,使其直接返回指向 selector 选取的 Pod 的 IP 地址
|
||||
|
||||
* 没有配置 Selector
|
||||
|
||||
Endpoints Controller 不创建 `Endpoints` 记录。DNS服务返回如下结果中的一种:
|
||||
* 对 ExternalName 类型的 Service,返回 CNAME 记录
|
||||
* 对于其他类型的 Service,返回与 Service 同名的 `Endpoints` 的 A 记录
|
||||
|
||||
## 支持的传输协议
|
||||
|
||||
|
||||
## Service 类型
|
||||
|
||||
### ClusterIP
|
||||
|
||||
### NodePort
|
||||
|
||||
### LoadBalancer
|
||||
|
||||
### ExternalName
|
||||
未完,待续,【2019年9月18日 22:33】
|
||||
|
||||
40
learning/k8s-intermediate/service/service-types.md
Normal file
40
learning/k8s-intermediate/service/service-types.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
layout: LearningLayout
|
||||
description: Kubernetes 中发布 Service 的方式,ServiceType
|
||||
---
|
||||
|
||||
# Service 类型
|
||||
|
||||
Kubernetes 中可以通过不同方式发布 Service,通过 `ServiceType` 字段指定,该字段的默认值是 `ClusterIP`,可选值有:
|
||||
|
||||
* **ClusterIP**: <Badge text="Kuboard 已支持" type="success"/> 默认值。通过集群内部的一个 IP 地址暴露 Service,只在集群内部可以访问
|
||||
|
||||
* **NodePort**: <Badge text="Kuboard 已支持" type="success"/> 通过每一个节点上的的静态端口(NodePort)暴露 Service,同时自动创建 ClusterIP 类型的访问方式
|
||||
* 在集群内部通过 $(ClusterIP): $(Port) 访问
|
||||
* 在集群外部通过 $(NodeIP): $(NodePort) 访问
|
||||
|
||||
* **LoadBalancer**: <Badge text="Kuboard 不支持" type="error"/> 通过云服务供应商(AWS、Azure、GCE 等)的负载均衡器在集群外部暴露 Service,同时自动创建 NodePort 和 ClusterIP 类型的访问方式
|
||||
* 在集群内部通过 $(ClusterIP): $(Port) 访问
|
||||
* 在集群外部通过 $(NodeIP): $(NodePort) 访问
|
||||
* 在集群外部通过 $(LoadBalancerIP): $(Port) 访问
|
||||
|
||||
::: tip 替代方案
|
||||
* LoadBalancer 类型的 Service,可以自动调用云服务商在 IaaS 层面的接口,并自动创建 LoadBalancer,将其指向该 Service。
|
||||
* 由于 Kuboard 不限定云服商,因此不能实现此类型的 Service,建议用户先创建 NodePort 类型的 Service,再手工创建 LoadBalancer,将其配置到各节点上对应的 Service 的 NodePort。此操作最终效果与 LoadBalancer 类型 Service 的效果相同
|
||||
:::
|
||||
|
||||
* **ExternalName**: <Badge text="Kuboard 暂不支持" type="warn"/> 将 Service 映射到 `externalName` 指定的地址(例如:foo.bar.example.com),返回值是一个 CNAME 记录。不使用任何代理机制。
|
||||
|
||||
::: tip
|
||||
如使用 ExternalName 类型的 Service,CoreDNS 版本不能低于 1.7
|
||||
:::
|
||||
|
||||
## ClusterIP
|
||||
|
||||
未完,待续,【2019年9月18日 22:56】
|
||||
|
||||
## NodePort
|
||||
|
||||
## LoadBalancer
|
||||
|
||||
## ExternalName
|
||||
@@ -16,7 +16,7 @@ Kubernetes 中 Pod 是随时可以消亡的(节点故障、容器内应用程
|
||||
|
||||
Service 存在的意义,就是为了解决这个问题。
|
||||
|
||||
## Service
|
||||
## Kubernetes Service
|
||||
|
||||
Kubernetes 中 Service 是一个 API 对象,通过 kubectl + YAML 或者 Kuboard,定义一个 Service,可以将符合 Service 指定条件的 Pod 作为可通过网络访问的服务提供给服务调用者。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user