K8s Cassandra and WordPress

This commit is contained in:
Vincent Fiduccia 2016-03-09 18:14:38 -07:00
parent c252d8e5c9
commit e112782d44
14 changed files with 807 additions and 0 deletions

View File

@ -0,0 +1,43 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: cassandra
name: cassandra
spec:
replicas: 1
selector:
name: cassandra
template:
metadata:
labels:
name: cassandra
spec:
containers:
- command:
- /run.sh
resources:
limits:
cpu: 0.1
env:
- name: MAX_HEAP_SIZE
value: 512M
- name: HEAP_NEWSIZE
value: 100M
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: gcr.io/google_containers/cassandra:v6
name: cassandra
ports:
- containerPort: 9042
name: cql
- containerPort: 9160
name: thrift
volumeMounts:
- mountPath: /cassandra_data
name: data
volumes:
- name: data
emptyDir: {}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: cassandra
name: cassandra
spec:
ports:
- port: 9042
selector:
name: cassandra

View File

@ -0,0 +1,35 @@
apiVersion: v1
kind: Pod
metadata:
labels:
name: cassandra
name: cassandra
spec:
containers:
- args:
- /run.sh
resources:
limits:
cpu: "0.1"
image: gcr.io/google_containers/cassandra:v6
name: cassandra
ports:
- name: cql
containerPort: 9042
- name: thrift
containerPort: 9160
volumeMounts:
- name: data
mountPath: /cassandra_data
env:
- name: MAX_HEAP_SIZE
value: 512M
- name: HEAP_NEWSIZE
value: 100M
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumes:
- name: data
emptyDir: {}

View File

@ -0,0 +1,4 @@
.catalog:
name: "K8s Example Cassandra"
version: "1.0.0"
description: ""

View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="279.18411"
height="187.47701"
id="svg2816"
xml:space="preserve"><title
id="title3537">Apache Cassandra</title><metadata
id="metadata2822"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>Apache Cassandra</dc:title><cc:license
rdf:resource="Apache License" /><dc:creator><cc:Agent><dc:title>Apache Software Foundation</dc:title></cc:Agent></dc:creator><dc:source>https://svn.apache.org/repos/asf/cassandra/logo/cassandra.svg</dc:source></cc:Work></rdf:RDF></metadata><defs
id="defs2820"><clipPath
id="clipPath2832"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2834" /></clipPath><clipPath
id="clipPath2844"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2846" /></clipPath><clipPath
id="clipPath2852"><path
d="m 96.0078,715.93 88.2902,0 0,-62.176 -88.2902,0 0,62.176 z"
id="path2854" /></clipPath><clipPath
id="clipPath2868"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2870" /></clipPath><clipPath
id="clipPath2880"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2882" /></clipPath><clipPath
id="clipPath2908"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2910" /></clipPath><clipPath
id="clipPath2936"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2938" /></clipPath><clipPath
id="clipPath2944"><path
d="m 121.202,708.378 45.899,0 0,-45.859 -45.899,0 0,45.859 z"
id="path2946" /></clipPath><clipPath
id="clipPath2960"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2962" /></clipPath><clipPath
id="clipPath2968"><path
d="m 40.4033,726.188 212.4017,0 0,-61.818 -212.4017,0 0,61.818 z"
id="path2970" /></clipPath><clipPath
id="clipPath2988"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path2990" /></clipPath><clipPath
id="clipPath2996"><path
d="m 39.5195,688.644 199.3805,0 0,-73.818 -199.3805,0 0,73.818 z"
id="path2998" /></clipPath><clipPath
id="clipPath3016"><path
d="M 0,792 612,792 612,0 0,0 0,792 z"
id="path3018" /></clipPath></defs><g
transform="translate(-62.668647,-74.06425)"
id="layer1"
style="display:inline"><g
transform="matrix(1.25,0,0,-1.25,19.117647,990)"
id="g3012"><g
clip-path="url(#clipPath3016)"
id="g3014"><g
transform="translate(61.4912,609.1372)"
id="g3020"><path
d="M 0,0 C 1.824,0 3.552,-0.432 4.417,-1.296 4.561,-2.641 3.36,-4.801 2.592,-4.801 1.68,-4.465 0.816,-4.272 -0.24,-4.272 c -4.368,0 -6.529,-4.513 -6.529,-8.977 0,-2.784 0.96,-4.465 3.169,-4.465 2.352,0 4.752,1.584 6.096,2.784 0.336,-0.239 0.768,-1.008 0.768,-1.872 0,-0.96 -0.288,-1.872 -1.152,-2.736 -1.536,-1.536 -4.128,-2.832 -7.873,-2.832 -4.32,0 -7.296,2.448 -7.296,8.161 C -13.057,-6.721 -8.113,0 -0.048,0 L 0,0 z"
id="path3022"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(75.6021,591.6636)"
id="g3024"><path
d="m 0,0 c 2.352,0 6.625,4.129 7.825,12.001 0.048,0.48 0.096,0.624 0.192,1.104 -0.528,0.192 -1.248,0.336 -1.969,0.336 -1.776,0 -3.6,-0.528 -5.232,-2.736 -1.68,-2.352 -2.4,-5.28 -2.4,-7.633 C -1.584,1.057 -1.008,0 -0.048,0 L 0,0 z m -7.729,2.16 c 0,2.832 0.96,7.777 4.561,11.377 3.072,3.168 6.816,3.937 10.225,3.937 2.256,0 5.328,-0.72 7.248,-1.105 -0.48,-2.112 -1.632,-10.08 -2.16,-14.688 -0.24,-1.969 -0.336,-4.705 -0.24,-5.713 -1.584,-0.672 -4.56,-0.864 -5.377,-0.864 -0.431,0 -0.528,1.968 -0.383,3.84 0.047,0.624 0.144,1.536 0.191,1.92 -1.872,-3.12 -5.568,-5.76 -9.456,-5.76 -2.784,0 -4.609,2.304 -4.609,7.008 l 0,0.048 z"
id="path3026"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(101.8579,609.1372)"
id="g3028"><path
d="m 0,0 c 1.968,0 3.84,-0.72 4.705,-1.632 -0.048,-1.345 -1.104,-3.6 -2.785,-2.976 -0.72,0.24 -1.44,0.431 -2.4,0.431 -1.296,0 -2.4,-0.576 -2.4,-1.775 0,-0.912 0.672,-1.585 3.888,-3.841 2.305,-1.68 3.217,-3.168 3.217,-5.28 0,-3.505 -3.313,-7.297 -9.073,-7.297 -2.352,0 -4.417,0.912 -5.089,1.872 -0.864,1.44 -0.192,4.272 0.769,3.793 1.248,-0.624 3.312,-1.297 4.992,-1.297 1.584,0 2.592,0.721 2.592,1.681 0,0.815 -0.72,1.536 -3.648,3.6 -2.449,1.824 -3.217,3.504 -3.217,5.424 0,3.984 3.409,7.297 8.401,7.297 L 0,0 z"
id="path3030"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(118.417,609.1372)"
id="g3032"><path
d="m 0,0 c 1.969,0 3.841,-0.72 4.705,-1.632 -0.048,-1.345 -1.103,-3.6 -2.784,-2.976 -0.72,0.24 -1.441,0.431 -2.4,0.431 -1.296,0 -2.4,-0.576 -2.4,-1.775 0,-0.912 0.672,-1.585 3.888,-3.841 2.304,-1.68 3.216,-3.168 3.216,-5.28 0,-3.505 -3.313,-7.297 -9.073,-7.297 -2.352,0 -4.416,0.912 -5.088,1.872 -0.864,1.44 -0.192,4.272 0.768,3.793 1.248,-0.624 3.312,-1.297 4.992,-1.297 1.584,0 2.592,0.721 2.592,1.681 0,0.815 -0.72,1.536 -3.648,3.6 -2.448,1.824 -3.216,3.504 -3.216,5.424 0,3.984 3.408,7.297 8.401,7.297 L 0,0 z"
id="path3034"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(133.5361,591.6636)"
id="g3036"><path
d="m 0,0 c 2.353,0 6.625,4.129 7.825,12.001 0.048,0.48 0.097,0.624 0.193,1.104 -0.529,0.192 -1.248,0.336 -1.969,0.336 -1.776,0 -3.6,-0.528 -5.233,-2.736 -1.679,-2.352 -2.4,-5.28 -2.4,-7.633 C -1.584,1.057 -1.008,0 -0.047,0 L 0,0 z m -7.729,2.16 c 0,2.832 0.961,7.777 4.561,11.377 3.072,3.168 6.816,3.937 10.225,3.937 2.256,0 5.329,-0.72 7.249,-1.105 -0.48,-2.112 -1.632,-10.08 -2.16,-14.688 -0.241,-1.969 -0.336,-4.705 -0.241,-5.713 -1.584,-0.672 -4.559,-0.864 -5.376,-0.864 -0.431,0 -0.528,1.968 -0.384,3.84 0.048,0.624 0.144,1.536 0.192,1.92 -1.872,-3.12 -5.568,-5.76 -9.456,-5.76 -2.785,0 -4.61,2.304 -4.61,7.008 l 0,0.048 z"
id="path3038"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(158.688,602.897)"
id="g3040"><path
d="m 0,0 c 2.209,3.552 5.088,6.24 9.121,6.24 3.408,0 4.512,-3.168 3.889,-7.68 -0.336,-2.113 -0.912,-5.137 -1.297,-7.921 -0.336,-2.353 -0.576,-4.464 -0.527,-5.905 -1.248,-0.624 -4.897,-0.864 -5.713,-0.864 -0.336,0 -0.385,2.641 0.048,5.425 0.383,2.304 1.2,6.48 1.584,8.881 0.241,1.391 0.192,3.072 -1.152,3.072 -1.777,0 -6,-2.833 -8.113,-14.449 -0.145,-0.96 -0.528,-1.536 -1.057,-1.872 -0.719,-0.433 -2.256,-0.817 -5.375,-0.865 0.576,2.928 1.488,8.929 2.16,13.345 0.623,4.032 0.864,6.625 0.719,7.633 0.817,0.288 5.09,1.2 5.568,1.2 C 0.385,6.24 0.48,4.752 0,1.151 -0.047,0.815 -0.096,0.288 -0.145,0 L 0,0 z"
id="path3042"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(183.0728,591.7114)"
id="g3044"><path
d="m 0,0 c 2.111,0 6.385,3.937 7.584,10.897 0.049,0.384 0.193,1.104 0.289,1.537 -0.625,0.576 -1.441,0.96 -2.736,0.96 -4.85,0 -7.01,-5.809 -7.01,-9.986 C -1.873,1.152 -1.104,0 -0.049,0 L 0,0 z m -3.168,-4.944 c -3.072,0 -4.992,2.736 -4.992,7.44 0,7.777 4.847,14.93 13.008,14.93 1.441,0 2.736,-0.384 3.552,-0.864 0.432,2.208 1.44,9.025 1.489,11.041 1.343,0.24 4.224,0.671 5.519,0.671 0.53,0 0.674,-0.527 0.481,-1.727 C 14.736,19.346 12.674,5.521 12.289,2.448 12,-0.144 11.953,-2.688 12,-4.128 10.465,-4.8 7.344,-4.944 6.529,-4.944 6.191,-4.944 6,-2.736 6.096,-0.768 6.145,-0.144 6.24,0.769 6.24,0.912 3.84,-3.024 0.527,-4.944 -3.121,-4.944 l -0.047,0 z"
id="path3046"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(208.0317,602.2241)"
id="g3048"><path
d="M 0,0 C 2.545,5.665 5.568,6.913 7.537,6.913 8.162,6.913 9.121,6.529 9.553,6.049 9.746,4.465 8.498,1.297 7.393,0.097 6.816,0.385 6.098,0.673 5.281,0.673 c -1.633,0 -4.849,-2.545 -6.865,-13.489 -0.145,-0.913 -0.432,-1.297 -0.959,-1.537 -0.816,-0.48 -4.033,-0.864 -5.568,-0.912 0.718,3.937 1.966,11.953 2.447,16.658 0.144,1.2 0.191,3.408 0.096,4.272 0.912,0.432 4.513,1.248 5.328,1.248 0.433,0 0.769,-2.641 0.095,-6.913 L 0,0 z"
id="path3050"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(224.9751,591.6636)"
id="g3052"><path
d="m 0,0 c 2.354,0 6.625,4.129 7.826,12.001 0.047,0.48 0.096,0.624 0.192,1.104 -0.528,0.192 -1.248,0.336 -1.969,0.336 -1.776,0 -3.6,-0.528 -5.233,-2.736 -1.679,-2.352 -2.4,-5.28 -2.4,-7.633 C -1.584,1.057 -1.008,0 -0.047,0 L 0,0 z m -7.729,2.16 c 0,2.832 0.961,7.777 4.561,11.377 3.072,3.168 6.816,3.937 10.225,3.937 2.256,0 5.328,-0.72 7.25,-1.105 -0.481,-2.112 -1.633,-10.08 -2.161,-14.688 -0.24,-1.969 -0.337,-4.705 -0.24,-5.713 -1.584,-0.672 -4.56,-0.864 -5.377,-0.864 -0.431,0 -0.527,1.968 -0.384,3.84 0.048,0.624 0.144,1.536 0.193,1.92 -1.873,-3.12 -5.568,-5.76 -9.457,-5.76 -2.785,0 -4.61,2.304 -4.61,7.008 l 0,0.048 z"
id="path3054"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g>
</g><g
transform="translate(-62.668647,-74.06425)"
id="layer2"
style="display:inline"><g
transform="matrix(1.25,0,0,-1.25,19.117647,990)"
id="g4555"><g
id="g2828"><g
clip-path="url(#clipPath2832)"
id="g2830"><g
transform="translate(210.8784,690.4834)"
id="g2836"><path
d="m 0,0 c 1.584,-18.452 -27.455,-36.014 -64.859,-39.223 -37.404,-3.209 -69.01,9.151 -70.592,27.602 -1.584,18.455 27.455,36.016 64.859,39.225 C -33.188,30.812 -1.582,18.455 0,0"
id="path2838"
style="fill:#bbe6fb;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g><g
id="g2840"><g
clip-path="url(#clipPath2844)"
id="g2842"><g
id="g2848"><g
id="g2850" /><g
id="g2856"><g
clip-path="url(#clipPath2852)"
id="g2858"
style="opacity:0.35000604"><g
transform="translate(141.3843,715.9233)"
id="g2860"><path
d="m 0,0 c -14.268,0.232 -30.964,-5.433 -43.387,-10.738 -1.293,-3.726 -1.989,-7.689 -1.989,-11.797 0,-21.888 19.764,-39.634 44.145,-39.634 24.381,0 44.145,17.746 44.145,39.634 0,6.927 -1.984,13.435 -5.463,19.101 C 27.512,-1.889 13.842,-0.225 0,0"
id="path2862"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g></g></g><g
id="g2864"><g
clip-path="url(#clipPath2868)"
id="g2866"><g
transform="translate(140.1528,715.9277)"
id="g2872"><path
d="m 0,0 c -7.899,0.482 -21.514,-3.639 -32.867,-7.75 -1.725,-4.071 -2.683,-8.526 -2.683,-13.201 0,-19.178 17.388,-34.725 35.782,-34.725 18.273,0 34.44,15.572 35.782,34.725 0.436,6.237 -1.711,12.114 -4.692,17.181 C 19.552,-1.697 7.061,-0.431 0,0"
id="path2874"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g><g
id="g2876"><g
clip-path="url(#clipPath2880)"
id="g2878"><g
transform="translate(119.8818,697.4946)"
id="g2884"><path
d="M 0,0 C 0.969,2.146 2.437,3.197 3.859,4.996 3.701,5.422 3.355,6.815 3.355,7.298 c 0,2.156 1.749,3.906 3.906,3.906 0.509,0 0.995,-0.101 1.44,-0.278 6.465,4.927 14.976,7.075 23.529,5.163 0.781,-0.176 1.547,-0.389 2.299,-0.623 C 26.076,16.638 16.548,13.644 10.067,8.413 10.265,7.946 10.814,6.611 10.814,6.074 10.814,3.917 9.418,3.392 7.261,3.392 6.771,3.392 6.303,3.486 5.87,3.651 4.406,1.685 2.612,-2.06 1.734,-4.401 c 3.584,-3.206 6.822,-4.368 11.042,-5.945 -0.011,0.201 0.145,0.387 0.145,0.592 0,6.503 5.725,11.788 12.229,11.788 5.828,0 10.654,-4.238 11.596,-9.798 2.908,1.85 5.72,3.268 7.863,6.01 -0.5,0.61 -1.039,2.337 -1.039,3.187 0,1.957 1.588,3.544 3.545,3.544 0.277,0 0.543,-0.04 0.802,-0.1 1.088,2.236 1.909,4.606 2.434,7.05 -10.17,7.529 -29.847,6.502 -29.847,6.502 0,0 -15.658,0.817 -26.258,-4.349 C -5.047,8.969 -3.008,4.11 0,0"
id="path2886"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(168.4907,700.4282)"
id="g2888"><path
d="m 0,0 c 0.719,-0.648 1.111,-1.217 1.42,-1.771 0.951,-1.71 -0.957,-3.275 -2.914,-3.275 -0.199,0 -0.391,0.027 -0.582,0.059 -2.205,-3.446 -6.067,-7.865 -9.498,-10.089 5.261,-0.862 10.222,-2.969 14.17,-6.225 2.875,5.151 5.08,12.589 5.08,18.907 0,4.809 -2.123,8.334 -5.328,10.92 C 2.18,5.95 0.805,2.347 0,0"
id="path2890"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(125.7842,667.8032)"
id="g2892"><path
d="M 0,0 C 1.753,4.841 6.065,8.592 10.144,11.892 9.547,12.709 8.652,14.732 8.279,15.69 3.304,17.203 -1.098,20.035 -4.512,23.784 -4.537,23.675 -4.568,23.569 -4.594,23.46 -5.237,20.579 -5.355,17.692 -5.035,14.876 -2.653,14.432 -0.85,12.345 -0.85,9.834 -0.85,8.345 -2.155,6.187 -3.168,5.248 -2.067,2.872 -1.316,1.726 0,0"
id="path2894"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(125.4756,663.7393)"
id="g2896"><path
d="m 0,0 c -2.091,2.079 -3.537,6.226 -4.894,8.83 -0.254,-0.039 -0.514,-0.066 -0.78,-0.066 -2.836,0 -5.807,2.38 -5.135,5.134 0.372,1.524 1.424,2.521 3.137,3.353 -0.39,3.157 -0.496,7.695 0.237,10.977 0.21,0.939 0.655,1.379 0.95,2.273 -3.129,4.579 -5.151,10.589 -5.151,16.552 0,0.218 0.011,0.433 0.016,0.649 -5.288,-2.652 -9.253,-6.83 -9.253,-13.407 0,-14.548 8.379,-28.819 20.846,-34.413 C -0.018,-0.079 -0.01,-0.039 0,0"
id="path2898"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(156.1313,683.8511)"
id="g2900"><path
d="m 0,0 c -1.611,-4.582 -5.967,-7.873 -11.1,-7.873 -2.746,0 -5.265,0.947 -7.267,2.521 -4.127,-3.214 -7.871,-8.86 -9.774,-13.758 0.854,-0.919 1.449,-1.675 2.407,-2.49 2.887,-0.752 6.863,0 9.988,0 12.57,0 23.703,5.592 30.086,15.398 C 10.096,-3.263 5.09,-0.466 0,0"
id="path2902"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g><g
id="g2904"><g
clip-path="url(#clipPath2908)"
id="g2906"><g
transform="translate(119.5596,695.7944)"
id="g2912"><path
d="m 0,0 c 0.969,2.146 2.184,4.132 3.605,5.931 -0.158,0.425 -0.25,0.884 -0.25,1.367 0,2.156 1.749,3.906 3.906,3.906 0.509,0 0.995,-0.101 1.44,-0.278 6.465,4.927 14.976,7.075 23.529,5.163 0.781,-0.176 1.547,-0.389 2.299,-0.623 -8.453,1.172 -17.187,-1.419 -23.668,-6.651 0.198,-0.466 0.306,-0.98 0.306,-1.517 0,-2.157 -1.749,-3.906 -3.906,-3.906 -0.49,0 -0.958,0.094 -1.391,0.259 -1.464,-1.966 -2.661,-4.138 -3.539,-6.48 3.078,-3.317 6.856,-5.94 11.075,-7.517 -0.01,0.201 -0.031,0.4 -0.031,0.605 0,6.503 5.271,11.775 11.775,11.775 5.828,0 10.654,-4.238 11.596,-9.798 2.908,1.85 5.492,4.226 7.634,6.968 -0.5,0.61 -0.81,1.379 -0.81,2.229 0,1.957 1.588,3.544 3.545,3.544 0.277,0 0.543,-0.04 0.802,-0.1 1.088,2.236 1.909,4.606 2.434,7.05 -10.17,7.529 -29.847,6.502 -29.847,6.502 0,0 -15.658,0.817 -26.258,-4.349 C -5.047,8.969 -3.008,4.11 0,0"
id="path2914"
style="fill:#1287b1;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(169.0396,699.8481)"
id="g2916"><path
d="m 0,0 c 0.719,-0.648 1.18,-1.577 1.18,-2.621 0,-1.957 -1.588,-3.545 -3.545,-3.545 -0.199,0 -0.391,0.027 -0.582,0.059 -2.205,-3.446 -5.127,-6.384 -8.559,-8.608 5.072,-0.793 9.846,-2.945 13.793,-6.201 2.875,5.151 4.518,11.084 4.518,17.402 0,4.809 -2.123,8.334 -5.328,10.92 C 1.309,4.83 0.805,2.347 0,0"
id="path2918"
style="fill:#1287b1;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(126.3252,666.6401)"
id="g2920"><path
d="M 0,0 C 1.753,4.841 4.799,9.185 8.878,12.484 8.281,13.302 7.789,14.195 7.416,15.153 2.44,16.666 -1.961,19.498 -5.375,23.247 -5.4,23.138 -5.432,23.032 -5.457,22.923 -6.101,20.042 -6.219,17.155 -5.898,14.339 -3.517,13.895 -1.713,11.808 -1.713,9.297 -1.713,7.808 -2.352,6.469 -3.365,5.53 -2.446,3.582 -1.316,1.726 0,0"
id="path2922"
style="fill:#1287b1;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(125.4619,663.7983)"
id="g2924"><path
d="m 0,0 c -2.091,2.079 -3.846,4.467 -5.202,7.07 -0.255,-0.039 -0.515,-0.065 -0.78,-0.065 -2.836,0 -5.135,2.299 -5.135,5.134 0,2.032 1.184,3.784 2.897,4.616 -0.389,3.156 -0.257,6.432 0.477,9.714 0.21,0.938 0.466,1.854 0.761,2.749 -3.129,4.578 -4.962,10.113 -4.962,16.076 0,0.218 0.01,0.433 0.015,0.648 -5.288,-2.651 -9.253,-6.83 -9.253,-13.406 0,-14.549 8.688,-27.06 21.155,-32.654 C -0.018,-0.079 -0.01,-0.039 0,0"
id="path2926"
style="fill:#1287b1;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g><g
transform="translate(155.8091,682.1509)"
id="g2928"><path
d="m 0,0 c -1.611,-4.582 -5.967,-7.873 -11.1,-7.873 -2.746,0 -5.265,0.947 -7.267,2.521 -4.127,-3.214 -7.242,-7.595 -9.144,-12.494 0.853,-0.919 1.765,-1.785 2.723,-2.599 2.888,-0.752 5.917,-1.155 9.042,-1.155 12.57,0 23.621,6.49 30.004,16.295 C 10.014,-2.365 5.09,-0.466 0,0"
id="path2930"
style="fill:#1287b1;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g><g
id="g2932"><g
clip-path="url(#clipPath2936)"
id="g2934"><g
id="g2940"><g
id="g2942" /><g
id="g2948"><g
clip-path="url(#clipPath2944)"
id="g2950"><g
transform="translate(156.2222,685.187)"
id="g2952"><path
d="M 0,0 10.879,2.595 -0.041,3.152 8.846,9.944 -1.238,6.329 5.615,15.826 -3.85,9.535 l 3.309,11.117 -6.5,-9.163 -0.148,11.579 -4.277,-10.314 -3.566,10.437 0.193,-12.295 -6.163,11.021 3.335,-11.702 -9.997,7.27 7.831,-9.84 -12.411,4.564 9.795,-7.247 -12.56,-0.386 12.842,-3.314 -12.853,-2.779 12.687,-0.92 -10.699,-6.851 11.017,3.994 -7.644,-9.681 9.659,7.79 -3.478,-12.991 7.457,10.572 -1.045,-12.486 4.233,11.319 3.603,-11.897 0.876,11.933 5.348,-10.181 -3.16,11.645 9.793,-7.586 -6.322,9.672 10.744,-4.186 -8.215,8.073 L 10.85,-4.164 0,0 z"
id="path2954"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g></g></g><g
id="g2956"><g
clip-path="url(#clipPath2960)"
id="g2958"><g
id="g2964"><g
id="g2966" /><g
id="g2972"><g
clip-path="url(#clipPath2968)"
id="g2974"
style="opacity:0.35000604"><g
transform="translate(40.4033,664.3701)"
id="g2976"><path
d="m 0,0 c 33.74,33.739 60.687,44.155 85.143,48.91 3.236,0.629 3.848,7.7 3.848,7.7 0,0 0.453,-5.208 2.718,-5.887 2.264,-0.68 5.207,8.152 5.207,8.152 0,0 -2.717,-7.926 0,-8.379 2.718,-0.453 7.699,7.699 7.699,7.699 0,0 -2.037,-7.019 -0.678,-7.472 1.357,-0.453 8.15,10.189 8.15,10.189 0,0 -4.076,-7.019 -0.226,-7.699 3.851,-0.679 9.467,4.791 9.467,4.791 0,0 -4.416,-5.005 -2.448,-5.696 8.379,-2.945 15.159,7.945 15.159,7.945 0,0 -1.571,-4.775 -5.647,-9.983 8.83,-2.264 15.389,11.039 15.389,11.039 l -6.559,-13.303 c 3.397,-1.813 16.985,13.812 16.985,13.812 0,0 -7.02,-12.228 -11.096,-14.718 2.264,-1.812 10.416,5.434 10.416,5.434 0,0 -6.567,-8.151 -4.076,-8.604 3.623,-2.944 16.982,15.171 16.982,15.171 0,0 -5.207,-10.642 -12.906,-19.021 6.435,-3.219 22.418,17.436 22.418,17.436 0,0 -0.453,-6.567 -12.002,-16.983 8.605,1.132 19.701,17.436 19.701,17.436 0,0 -4.076,-12.228 -13.814,-20.832 8.449,0.879 21.964,21.738 21.964,21.738 0,0 -5.207,-14.492 -15.849,-22.871 11.775,-2.604 28.758,14.945 28.758,14.945 0,0 -6.68,-12.455 -15.399,-17.549 9.738,-3.736 23.098,11.662 23.098,11.662 0,0 -13.36,-20.607 -34.645,-19.701 -6.984,0.297 -28.109,21.188 -73.368,19.474 C 44.609,42.57 31.929,17.209 0,0"
id="path2978"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g><g
transform="translate(41.7861,666.9326)"
id="g2980"><path
d="m 0,0 c 33.74,33.739 60.686,44.154 85.142,48.91 3.237,0.629 3.849,7.699 3.849,7.699 0,0 0.452,-5.209 2.718,-5.887 2.264,-0.679 5.207,8.151 5.207,8.151 0,0 -2.717,-7.926 0,-8.378 2.718,-0.452 7.699,7.699 7.699,7.699 0,0 -2.037,-7.019 -0.68,-7.472 1.359,-0.453 8.152,10.19 8.152,10.19 0,0 -4.076,-7.02 -0.226,-7.699 3.849,-0.68 9.467,4.79 9.467,4.79 0,0 -4.416,-5.005 -2.448,-5.696 8.379,-2.944 15.157,7.945 15.157,7.945 0,0 -1.571,-4.775 -5.645,-9.983 8.83,-2.265 15.389,11.04 15.389,11.04 l -6.559,-13.305 c 3.397,-1.811 16.983,13.812 16.983,13.812 0,0 -7.018,-12.226 -11.094,-14.717 2.264,-1.812 10.416,5.434 10.416,5.434 0,0 -6.567,-8.152 -4.076,-8.604 3.623,-2.945 16.982,15.171 16.982,15.171 0,0 -5.209,-10.643 -12.906,-19.021 6.435,-3.22 22.418,17.436 22.418,17.436 0,0 -0.453,-6.568 -12.002,-16.984 8.605,1.133 19.701,17.437 19.701,17.437 0,0 -4.076,-12.228 -13.814,-20.833 8.449,0.879 21.964,21.738 21.964,21.738 0,0 -5.207,-14.492 -15.849,-22.87 11.775,-2.604 28.758,14.944 28.758,14.944 0,0 -6.68,-12.453 -15.399,-17.548 9.738,-3.736 23.098,11.662 23.098,11.662 0,0 -13.36,-20.607 -34.647,-19.701 -6.982,0.298 -28.107,21.189 -73.367,19.474 C 44.609,42.57 31.928,17.209 0,0"
id="path2982"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g><g
id="g2984"><g
clip-path="url(#clipPath2988)"
id="g2986"><g
id="g2992"><g
id="g2994" /><g
id="g3000"><g
clip-path="url(#clipPath2996)"
id="g3002"
style="opacity:0.35000604"><g
transform="translate(39.5195,660.6802)"
id="g3004"><path
d="m 0,0 c 17.832,-8.945 34.137,1.358 54.686,-4.433 15.623,-4.404 34.645,-9.833 60.458,-6.096 25.814,3.735 47.893,14.944 58.424,34.985 3.283,8.943 16.642,-2.039 16.642,-2.039 0,0 -9.736,4.076 -9.509,2.151 0.226,-1.924 14.605,-8.604 14.605,-8.604 0,0 -13.021,4.076 -12.228,1.019 0.793,-3.057 16.302,-15.285 16.302,-15.285 0,0 -17.548,13.36 -19.019,11.549 -1.473,-1.812 7.472,-9.172 7.472,-9.172 0,0 -14.832,9.172 -20.041,6.467 -3.746,-1.943 15.399,-14.506 15.399,-14.506 0,0 -12.455,9.512 -15.399,7.021 -2.943,-2.492 14.04,-22.871 14.04,-22.871 0,0 -19.249,20.833 -21.172,19.814 -1.926,-1.019 5.32,-10.983 5.32,-10.983 0,0 -9.51,10.417 -12.113,8.605 -2.604,-1.812 13.586,-28.871 13.586,-28.871 0,0 -17.549,27.738 -24.795,23.098 11.379,-24.966 7.133,-28.533 7.133,-28.533 0,0 -1.452,25.47 -15.625,24.796 -7.133,-0.34 3.396,-19.021 3.396,-19.021 0,0 -9.691,17.062 -16.145,16.722 11.895,-22.511 7.655,-31.667 7.655,-31.667 0,0 1.967,19.226 -14.166,29.925 6.113,-5.433 -3.836,-29.925 -3.836,-29.925 0,0 8.752,36.091 -6.455,29.21 -2.403,-1.085 -0.17,-18.002 -0.17,-18.002 0,0 -3.057,19.362 -7.641,18.342 -2.673,-0.593 -16.984,-26.833 -16.984,-26.833 0,0 11.719,28.362 8.153,27.173 -2.598,-0.867 -7.473,-12.568 -7.473,-12.568 0,0 2.377,11.549 0,12.228 -2.377,0.68 -15.625,-12.228 -15.625,-12.228 0,0 9.851,11.549 8.152,13.927 -2.574,3.603 -5.591,3.772 -9.171,2.377 -5.209,-2.03 -12.227,-11.548 -12.227,-11.548 0,0 6.996,9.637 5.773,13.247 -1.963,5.8 -22.077,-11.209 -22.077,-11.209 0,0 11.888,11.209 9.171,13.587 -2.717,2.377 -17.471,1.642 -22.078,1.655 C 8.832,-6.454 4.124,-3.267 0,0"
id="path3006"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g><g
transform="translate(38.8408,662.7183)"
id="g3008"><path
d="m 0,0 c 17.832,-8.945 34.136,1.358 54.685,-4.434 15.623,-4.402 34.646,-9.832 60.46,-6.095 25.814,3.736 47.891,14.945 58.422,34.984 3.283,8.944 16.642,-2.037 16.642,-2.037 0,0 -9.736,4.075 -9.509,2.15 0.226,-1.924 14.605,-8.604 14.605,-8.604 0,0 -13.021,4.075 -12.228,1.018 0.793,-3.056 16.304,-15.284 16.304,-15.284 0,0 -17.55,13.361 -19.021,11.548 -1.471,-1.811 7.473,-9.17 7.473,-9.17 0,0 -14.833,9.17 -20.041,6.467 -3.747,-1.944 15.398,-14.506 15.398,-14.506 0,0 -12.455,9.511 -15.398,7.02 -2.944,-2.492 14.041,-22.871 14.041,-22.871 0,0 -19.25,20.833 -21.174,19.814 -1.924,-1.02 5.322,-10.982 5.322,-10.982 0,0 -9.512,10.416 -12.115,8.604 -2.604,-1.811 13.586,-28.871 13.586,-28.871 0,0 -17.549,27.739 -24.795,23.097 11.379,-24.965 7.133,-28.532 7.133,-28.532 0,0 -1.452,25.47 -15.625,24.795 -7.133,-0.34 3.396,-19.02 3.396,-19.02 0,0 -9.691,17.063 -16.144,16.723 11.896,-22.512 7.654,-31.668 7.654,-31.668 0,0 1.967,19.227 -14.166,29.926 6.113,-5.434 -3.836,-29.926 -3.836,-29.926 0,0 8.754,36.091 -6.453,29.21 -2.403,-1.086 -0.17,-18.002 -0.17,-18.002 0,0 -3.059,19.361 -7.642,18.342 -2.674,-0.593 -16.985,-26.833 -16.985,-26.833 0,0 11.719,28.362 8.153,27.172 -2.598,-0.865 -7.473,-12.566 -7.473,-12.566 0,0 2.378,11.548 0,12.227 -2.377,0.679 -15.624,-12.227 -15.624,-12.227 0,0 9.851,11.548 8.151,13.926 -2.574,3.603 -5.591,3.771 -9.17,2.376 -5.21,-2.029 -12.228,-11.547 -12.228,-11.547 0,0 6.996,9.638 5.774,13.247 -1.964,5.799 -22.077,-11.209 -22.077,-11.209 0,0 11.888,11.209 9.17,13.586 C 41.778,-5.774 27.024,-6.51 22.417,-6.496 8.831,-6.453 4.124,-3.267 0,0"
id="path3010"
style="fill:#373535;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,4 @@
name: "K8s Example Cassandra"
description: "Distributed Database"
version: 1.0.0
category: Databases

View File

@ -0,0 +1,341 @@
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
# Persistent Installation of MySQL and WordPress on Kubernetes
This example describes how to run a persistent installation of [Wordpress](https://wordpress.org/) using the [volumes](../../docs/user-guide/volumes.md) feature of Kubernetes, and [Google Compute Engine](https://cloud.google.com/compute/docs/disks) [persistent disks](../../docs/user-guide/volumes.md#gcepersistentdisk).
We'll use the [mysql](https://registry.hub.docker.com/_/mysql/) and [wordpress](https://registry.hub.docker.com/_/wordpress/) official [Docker](https://www.docker.com/) images for this installation. (The wordpress image includes an Apache server).
We'll create two Kubernetes [pods](../../docs/user-guide/pods.md) to run mysql and wordpress, both with associated persistent disks, then set up a Kubernetes [service](../../docs/user-guide/services.md) to front each pod.
This example demonstrates several useful things, including: how to set up and use persistent disks with Kubernetes pods; how to define Kubernetes services to leverage docker-links-compatible service environment variables; and use of an external load balancer to expose the wordpress service externally and make it transparent to the user if the wordpress pod moves to a different cluster node.
## Get started on Google Compute Engine (GCE)
Because we're using the `GCEPersistentDisk` type of volume for persistent storage, this example is only applicable to [Google Compute Engine](https://cloud.google.com/compute/). Take a look at the [volumes documentation](../../docs/user-guide/volumes.md) for other options.
First, if you have not already done so:
1. [Create](https://cloud.google.com/compute/docs/quickstart) a [Google Cloud Platform](https://cloud.google.com/) project.
2. [Enable billing](https://developers.google.com/console/help/new/#billing).
3. Install the [gcloud SDK](https://cloud.google.com/sdk/).
Authenticate with gcloud and set the gcloud default project name to point to the project you want to use for your Kubernetes cluster:
```sh
gcloud auth login
gcloud config set project <project-name>
```
Next, start up a Kubernetes cluster:
```sh
wget -q -O - https://get.k8s.io | bash
```
Please see the [GCE getting started guide](../../docs/getting-started-guides/gce.md) for full details and other options for starting a cluster.
## Create two persistent disks
For this WordPress installation, we're going to configure our Kubernetes [pods](../../docs/user-guide/pods.md) to use [persistent disks](https://cloud.google.com/compute/docs/disks). This means that we can preserve installation state across pod shutdown and re-startup.
You will need to create the disks in the same [GCE zone](https://cloud.google.com/compute/docs/zones) as the Kubernetes cluster. The default setup script will create the cluster in the `us-central1-b` zone, as seen in the [config-default.sh](../../cluster/gce/config-default.sh) file. Replace `$ZONE` below with the appropriate zone.
We will create two disks: one for the mysql pod, and one for the wordpress pod. In this example, we create 20GB disks, which will be sufficient for this demo. Feel free to change the size to align with your needs, as wordpress requirements can vary. Also, keep in mind that [disk performance scales with size](https://cloud.google.com/compute/docs/disks/#comparison_of_disk_types).
First create the mysql disk.
```sh
gcloud compute disks create --size=20GB --zone=$ZONE mysql-disk
```
Then create the wordpress disk.
```sh
gcloud compute disks create --size=20GB --zone=$ZONE wordpress-disk
```
## Start the Mysql Pod and Service
Now that the persistent disks are defined, the Kubernetes pods can be launched. We'll start with the mysql pod.
### Start the Mysql pod
First, **edit [`mysql.yaml`](mysql.yaml)**, the mysql pod definition, to use a database password that you specify.
`mysql.yaml` looks like this:
<!-- BEGIN MUNGE: EXAMPLE mysql.yaml -->
```yaml
apiVersion: v1
kind: Pod
metadata:
name: mysql
labels:
name: mysql
spec:
containers:
- resources:
limits :
cpu: 0.5
image: mysql
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
# change this
value: yourpassword
ports:
- containerPort: 3306
name: mysql
volumeMounts:
# name must match the volume name below
- name: mysql-persistent-storage
# mount path within the container
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
gcePersistentDisk:
# This GCE PD must already exist.
pdName: mysql-disk
fsType: ext4
```
[Download example](mysql.yaml?raw=true)
<!-- END MUNGE: EXAMPLE mysql.yaml -->
Note that we've defined a volume mount for `/var/lib/mysql`, and specified a volume that uses the persistent disk (`mysql-disk`) that you created.
Once you've edited the file to set your database password, create the pod as follows, where `<kubernetes>` is the path to your Kubernetes installation:
```sh
$ kubectl create -f examples/mysql-wordpress-pd/mysql.yaml
```
It may take a short period before the new pod reaches the `Running` state.
List all pods to see the status of this new pod and the cluster node that it is running on:
```sh
$ kubectl get pods
```
#### Check the running pod on the Compute instance
You can take a look at the logs for a pod by using `kubectl.sh log`. For example:
```sh
$ kubectl logs mysql
```
If you want to do deeper troubleshooting, e.g. if it seems a container is not staying up, you can also ssh in to the node that a pod is running on. There, you can run `sudo -s`, then `docker ps -a` to see all the containers. You can then inspect the logs of containers that have exited, via `docker logs <container_id>`. (You can also find some relevant logs under `/var/log`, e.g. `docker.log` and `kubelet.log`).
### Start the Mysql service
We'll define and start a [service](../../docs/user-guide/services.md) that lets other pods access the mysql database on a known port and host.
We will specifically name the service `mysql`. This will let us leverage the support for [Docker-links-compatible](../../docs/user-guide/services.md#how-do-they-work) service environment variables when we set up the wordpress pod. The wordpress Docker image expects to be linked to a mysql container named `mysql`, as you can see in the "How to use this image" section on the wordpress docker hub [page](https://registry.hub.docker.com/_/wordpress/).
So if we label our Kubernetes mysql service `mysql`, the wordpress pod will be able to use the Docker-links-compatible environment variables, defined by Kubernetes, to connect to the database.
The [`mysql-service.yaml`](mysql-service.yaml) file looks like this:
<!-- BEGIN MUNGE: EXAMPLE mysql-service.yaml -->
```yaml
apiVersion: v1
kind: Service
metadata:
labels:
name: mysql
name: mysql
spec:
ports:
# the port that this service should serve on
- port: 3306
# label keys and values that must match in order to receive traffic for this service
selector:
name: mysql
```
[Download example](mysql-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE mysql-service.yaml -->
Start the service like this:
```sh
$ kubectl create -f examples/mysql-wordpress-pd/mysql-service.yaml
```
You can see what services are running via:
```sh
$ kubectl get services
```
## Start the WordPress Pod and Service
Once the mysql service is up, start the wordpress pod, specified in
[`wordpress.yaml`](wordpress.yaml). Before you start it, **edit `wordpress.yaml`** and **set the database password to be the same as you used in `mysql.yaml`**.
Note that this config file also defines a volume, this one using the `wordpress-disk` persistent disk that you created.
<!-- BEGIN MUNGE: EXAMPLE wordpress.yaml -->
```yaml
apiVersion: v1
kind: Pod
metadata:
name: wordpress
labels:
name: wordpress
spec:
containers:
- image: wordpress
name: wordpress
env:
- name: WORDPRESS_DB_PASSWORD
# change this - must match mysql.yaml password
value: yourpassword
ports:
- containerPort: 80
name: wordpress
volumeMounts:
# name must match the volume name below
- name: wordpress-persistent-storage
# mount path within the container
mountPath: /var/www/html
volumes:
- name: wordpress-persistent-storage
gcePersistentDisk:
# This GCE PD must already exist.
pdName: wordpress-disk
fsType: ext4
```
[Download example](wordpress.yaml?raw=true)
<!-- END MUNGE: EXAMPLE wordpress.yaml -->
Create the pod:
```sh
$ kubectl create -f examples/mysql-wordpress-pd/wordpress.yaml
```
And list the pods to check that the status of the new pod changes
to `Running`. As above, this might take a minute.
```sh
$ kubectl get pods
```
### Start the WordPress service
Once the wordpress pod is running, start its service, specified by [`wordpress-service.yaml`](wordpress-service.yaml).
The service config file looks like this:
<!-- BEGIN MUNGE: EXAMPLE wordpress-service.yaml -->
```yaml
apiVersion: v1
kind: Service
metadata:
labels:
name: wpfrontend
name: wpfrontend
spec:
ports:
# the port that this service should serve on
- port: 80
# label keys and values that must match in order to receive traffic for this service
selector:
name: wordpress
type: LoadBalancer
```
[Download example](wordpress-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE wordpress-service.yaml -->
Note the `type: LoadBalancer` setting. This will set up the wordpress service behind an external IP.
Note also that we've set the service port to 80. We'll return to that shortly.
Start the service:
```sh
$ kubectl create -f examples/mysql-wordpress-pd/wordpress-service.yaml
```
and see it in the list of services:
```sh
$ kubectl get services
```
Then, find the external IP for your WordPress service by running:
```console
$ kubectl get services/wpfrontend
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
wpfrontend 10.0.0.2 1.2.3.4 80/TCP ... ...
```
or by listing the forwarding rules for your project:
```sh
$ gcloud compute forwarding-rules list
```
Look for the rule called `wpfrontend`, which is what we named the wordpress service, and note its IP address.
## Visit your new WordPress blog
To access your new installation, you first may need to open up port 80 (the port specified in the wordpress service config) in the firewall for your cluster. You can do this, e.g. via:
```sh
$ gcloud compute firewall-rules create sample-http --allow tcp:80
```
This will define a firewall rule called `sample-http` that opens port 80 in the default network for your project.
Now, we can visit the running WordPress app.
Use the external IP that you obtained above, and visit it on port 80:
```
http://<external-ip>
```
You should see the familiar WordPress init page.
## Take down and restart your blog
Set up your WordPress blog and play around with it a bit. Then, take down its pods and bring them back up again. Because you used persistent disks, your blog state will be preserved.
If you are just experimenting, you can take down and bring up only the pods:
```sh
$ kubectl delete -f examples/mysql-wordpress-pd/wordpress.yaml
$ kubectl delete -f examples/mysql-wordpress-pd/mysql.yaml
```
When you restart the pods again (using the `create` operation as described above), their services will pick up the new pods based on their labels.
If you want to shut down the entire app installation, you can delete the services as well.
If you are ready to turn down your Kubernetes cluster altogether, run:
```sh
$ cluster/kube-down.sh
```
<!-- BEGIN MUNGE: IS_VERSIONED -->
<!-- TAG IS_VERSIONED -->
<!-- END MUNGE: IS_VERSIONED -->
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/mysql-wordpress-pd/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: mysql
name: mysql
spec:
ports:
# the port that this service should serve on
- port: 3306
# label keys and values that must match in order to receive traffic for this service
selector:
name: mysql

View File

@ -0,0 +1,31 @@
apiVersion: v1
kind: Pod
metadata:
name: mysql
labels:
name: mysql
spec:
containers:
- resources:
limits :
cpu: 0.5
image: mysql
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
# change this
value: yourpassword
ports:
- containerPort: 3306
name: mysql
volumeMounts:
# name must match the volume name below
- name: mysql-persistent-storage
# mount path within the container
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
gcePersistentDisk:
# This GCE PD must already exist.
pdName: mysql-disk
fsType: ext4

View File

@ -0,0 +1,4 @@
.catalog:
name: "K8s Example Wordpress"
version: "1.0.0"
description: ""

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: wpfrontend
name: wpfrontend
spec:
ports:
# the port that this service should serve on
- port: 80
# label keys and values that must match in order to receive traffic for this service
selector:
name: wordpress
type: LoadBalancer

View File

@ -0,0 +1,28 @@
apiVersion: v1
kind: Pod
metadata:
name: wordpress
labels:
name: wordpress
spec:
containers:
- image: wordpress
name: wordpress
env:
- name: WORDPRESS_DB_PASSWORD
# change this - must match mysql.yaml password
value: yourpassword
ports:
- containerPort: 80
name: wordpress
volumeMounts:
# name must match the volume name below
- name: wordpress-persistent-storage
# mount path within the container
mountPath: /var/www/html
volumes:
- name: wordpress-persistent-storage
gcePersistentDisk:
# This GCE PD must already exist.
pdName: wordpress-disk
fsType: ext4

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-241 323.5 122.5 122.5" enable-background="new -241 323.5 122.5 122.5" xml:space="preserve">
<g id="Layer_1_1_">
</g>
<g>
<path fill="#464342" d="M-232.3,384.7c0,20.8,12.1,38.8,29.6,47.3l-25.1-68.7C-230.7,369.9-232.3,377.1-232.3,384.7z"/>
<path fill="#464342" d="M-144.3,382.1c0-6.5-2.3-11-4.3-14.5c-2.7-4.3-5.2-8-5.2-12.3c0-4.8,3.7-9.3,8.8-9.3c0.2,0,0.5,0,0.7,0
c-9.3-8.6-21.8-13.8-35.5-13.8c-18.4,0-34.5,9.4-43.9,23.7c1.2,0,2.4,0.1,3.4,0.1c5.5,0,14-0.7,14-0.7c2.8-0.2,3.2,4,0.3,4.3
c0,0-2.8,0.3-6,0.5l19.1,56.9l11.5-34.5l-8.2-22.4c-2.8-0.2-5.5-0.5-5.5-0.5c-2.8-0.2-2.5-4.5,0.3-4.3c0,0,8.7,0.7,13.8,0.7
c5.5,0,14-0.7,14-0.7c2.8-0.2,3.2,4,0.3,4.3c0,0-2.9,0.3-6,0.5l19,56.5l5.2-17.5C-146,391.8-144.3,386.6-144.3,382.1z"/>
<path fill="#464342" d="M-178.8,389.3l-15.8,45.8c4.7,1.4,9.7,2.1,14.8,2.1c6.1,0,12-1.1,17.5-3c-0.1-0.2-0.3-0.5-0.4-0.7
L-178.8,389.3z"/>
<path fill="#464342" d="M-133.6,359.5c0.2,1.7,0.4,3.5,0.4,5.4c0,5.3-1,11.3-4,18.8l-16.1,46.4c15.6-9.1,26.1-26,26.1-45.4
C-127.2,375.6-129.5,367-133.6,359.5z"/>
<path fill="#464342" d="M-179.7,323.5c-33.8,0-61.3,27.5-61.3,61.3c0,33.8,27.5,61.3,61.3,61.3c33.8,0,61.3-27.5,61.3-61.3
C-118.5,351-146,323.5-179.7,323.5z M-179.7,443.2c-32.2,0-58.5-26.2-58.5-58.5c0-32.2,26.2-58.5,58.5-58.5
c32.2,0,58.5,26.2,58.5,58.5C-121.3,417-147.5,443.2-179.7,443.2z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,4 @@
name: "K8s Example WordPress"
description: "Blogging platform"
version: 1.0.0
category: "Blog tool, publishing platform and CMS"