mirror of
https://github.com/jcwimer/kubernetes-ansible
synced 2026-03-24 16:44:44 +00:00
Initial Commit
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.vagrant/
|
||||
hosts
|
||||
group_vars/all
|
||||
ubuntu*.log
|
||||
playbooks/*.retry
|
||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
14
Pipfile
Normal file
14
Pipfile
Normal file
@@ -0,0 +1,14 @@
|
||||
[[source]]
|
||||
|
||||
url = "https://pypi.python.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
|
||||
[dev-packages]
|
||||
|
||||
|
||||
|
||||
[packages]
|
||||
|
||||
ansible = "==2.4.1"
|
||||
249
Pipfile.lock
generated
Normal file
249
Pipfile.lock
generated
Normal file
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "c034651567e687bee15d234d98849caaa88647ab341c3b8f41eb4daa01eb8ce7"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.python.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"ansible": {
|
||||
"hashes": [
|
||||
"sha256:da61afb29cc5bd6bc4737a2da06e673fb6fccc3ae2685130d19ab3a8e404fb6a"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.4.1"
|
||||
},
|
||||
"asn1crypto": {
|
||||
"hashes": [
|
||||
"sha256:2f1adbb7546ed199e3c90ef23ec95c5cf3585bac7d11fb7eb562a3fe89c64e87",
|
||||
"sha256:9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49"
|
||||
],
|
||||
"version": "==0.24.0"
|
||||
},
|
||||
"bcrypt": {
|
||||
"hashes": [
|
||||
"sha256:01477981abf74e306e8ee31629a940a5e9138de000c6b0898f7f850461c4a0a5",
|
||||
"sha256:054d6e0acaea429e6da3613fcd12d05ee29a531794d96f6ab959f29a39f33391",
|
||||
"sha256:0872eeecdf9a429c1420158500eedb323a132bc5bf3339475151c52414729e70",
|
||||
"sha256:09a3b8c258b815eadb611bad04ca15ec77d86aa9ce56070e1af0d5932f17642a",
|
||||
"sha256:0f317e4ffbdd15c3c0f8ab5fbd86aa9aabc7bea18b5cc5951b456fe39e9f738c",
|
||||
"sha256:2788c32673a2ad0062bea850ab73cffc0dba874db10d7a3682b6f2f280553f20",
|
||||
"sha256:321d4d48be25b8d77594d8324c0585c80ae91ac214f62db9098734e5e7fb280f",
|
||||
"sha256:346d6f84ff0b493dbc90c6b77136df83e81f903f0b95525ee80e5e6d5e4eef84",
|
||||
"sha256:34dd60b90b0f6de94a89e71fcd19913a30e83091c8468d0923a93a0cccbfbbff",
|
||||
"sha256:3b4c23300c4eded8895442c003ae9b14328ae69309ac5867e7530de8bdd7875d",
|
||||
"sha256:43d1960e7db14042319c46925892d5fa99b08ff21d57482e6f5328a1aca03588",
|
||||
"sha256:49e96267cd9be55a349fd74f9852eb9ae2c427cd7f6455d0f1765d7332292832",
|
||||
"sha256:63e06ffdaf4054a89757a3a1ab07f1b922daf911743114a54f7c561b9e1baa58",
|
||||
"sha256:67ed1a374c9155ec0840214ce804616de49c3df9c5bc66740687c1c9b1cd9e8d",
|
||||
"sha256:6b662a5669186439f4f583636c8d6ea77cf92f7cfe6aae8d22edf16c36840574",
|
||||
"sha256:6efd9ca20aefbaf2e7e6817a2c6ed4a50ff6900fafdea1bcb1d0e9471743b144",
|
||||
"sha256:8569844a5d8e1fdde4d7712a05ab2e6061343ac34af6e7e3d7935b2bd1907bfd",
|
||||
"sha256:8629ea6a8a59f865add1d6a87464c3c676e60101b8d16ef404d0a031424a8491",
|
||||
"sha256:988cac675e25133d01a78f2286189c1f01974470817a33eaf4cfee573cfb72a5",
|
||||
"sha256:9a6fedda73aba1568962f7543a1f586051c54febbc74e87769bad6a4b8587c39",
|
||||
"sha256:9eced8962ce3b7124fe20fd358cf8c7470706437fa064b9874f849ad4c5866fc",
|
||||
"sha256:a005ed6163490988711ff732386b08effcbf8df62ae93dd1e5bda0714fad8afb",
|
||||
"sha256:ae35dbcb6b011af6c840893b32399252d81ff57d52c13e12422e16b5fea1d0fb",
|
||||
"sha256:b1e8491c6740f21b37cca77bc64677696a3fb9f32360794d57fa8477b7329eda",
|
||||
"sha256:c906bdb482162e9ef48eea9f8c0d967acceb5c84f2d25574c7d2a58d04861df1",
|
||||
"sha256:cb18ffdc861dbb244f14be32c47ab69604d0aca415bee53485fcea4f8e93d5ef",
|
||||
"sha256:cc2f24dc1c6c88c56248e93f28d439ee4018338567b0bbb490ea26a381a29b1e",
|
||||
"sha256:d860c7fff18d49e20339fc6dffc2d485635e36d4b2cccf58f45db815b64100b4",
|
||||
"sha256:d86da365dda59010ba0d1ac45aa78390f56bf7f992e65f70b3b081d5e5257b09",
|
||||
"sha256:e22f0997622e1ceec834fd25947dc2ee2962c2133ea693d61805bc867abaf7ea",
|
||||
"sha256:f2fe545d27a619a552396533cddf70d83cecd880a611cdfdbb87ca6aec52f66b",
|
||||
"sha256:f425e925485b3be48051f913dbe17e08e8c48588fdf44a26b8b14067041c0da6",
|
||||
"sha256:f7fd3ed3745fe6e81e28dc3b3d76cce31525a91f32a387e1febd6b982caf8cdb",
|
||||
"sha256:f9210820ee4818d84658ed7df16a7f30c9fba7d8b139959950acef91745cc0f7"
|
||||
],
|
||||
"version": "==3.1.4"
|
||||
},
|
||||
"cffi": {
|
||||
"hashes": [
|
||||
"sha256:151b7eefd035c56b2b2e1eb9963c90c6302dc15fbd8c1c0a83a163ff2c7d7743",
|
||||
"sha256:1553d1e99f035ace1c0544050622b7bc963374a00c467edafac50ad7bd276aef",
|
||||
"sha256:1b0493c091a1898f1136e3f4f991a784437fac3673780ff9de3bcf46c80b6b50",
|
||||
"sha256:2ba8a45822b7aee805ab49abfe7eec16b90587f7f26df20c71dd89e45a97076f",
|
||||
"sha256:3bb6bd7266598f318063e584378b8e27c67de998a43362e8fce664c54ee52d30",
|
||||
"sha256:3c85641778460581c42924384f5e68076d724ceac0f267d66c757f7535069c93",
|
||||
"sha256:3eb6434197633b7748cea30bf0ba9f66727cdce45117a712b29a443943733257",
|
||||
"sha256:495c5c2d43bf6cebe0178eb3e88f9c4aa48d8934aa6e3cddb865c058da76756b",
|
||||
"sha256:4c91af6e967c2015729d3e69c2e51d92f9898c330d6a851bf8f121236f3defd3",
|
||||
"sha256:57b2533356cb2d8fac1555815929f7f5f14d68ac77b085d2326b571310f34f6e",
|
||||
"sha256:770f3782b31f50b68627e22f91cb182c48c47c02eb405fd689472aa7b7aa16dc",
|
||||
"sha256:79f9b6f7c46ae1f8ded75f68cf8ad50e5729ed4d590c74840471fc2823457d04",
|
||||
"sha256:7a33145e04d44ce95bcd71e522b478d282ad0eafaf34fe1ec5bbd73e662f22b6",
|
||||
"sha256:857959354ae3a6fa3da6651b966d13b0a8bed6bbc87a0de7b38a549db1d2a359",
|
||||
"sha256:87f37fe5130574ff76c17cab61e7d2538a16f843bb7bca8ebbc4b12de3078596",
|
||||
"sha256:95d5251e4b5ca00061f9d9f3d6fe537247e145a8524ae9fd30a2f8fbce993b5b",
|
||||
"sha256:9d1d3e63a4afdc29bd76ce6aa9d58c771cd1599fbba8cf5057e7860b203710dd",
|
||||
"sha256:a36c5c154f9d42ec176e6e620cb0dd275744aa1d804786a71ac37dc3661a5e95",
|
||||
"sha256:a6a5cb8809091ec9ac03edde9304b3ad82ad4466333432b16d78ef40e0cce0d5",
|
||||
"sha256:ae5e35a2c189d397b91034642cb0eab0e346f776ec2eb44a49a459e6615d6e2e",
|
||||
"sha256:b0f7d4a3df8f06cf49f9f121bead236e328074de6449866515cea4907bbc63d6",
|
||||
"sha256:b75110fb114fa366b29a027d0c9be3709579602ae111ff61674d28c93606acca",
|
||||
"sha256:ba5e697569f84b13640c9e193170e89c13c6244c24400fc57e88724ef610cd31",
|
||||
"sha256:be2a9b390f77fd7676d80bc3cdc4f8edb940d8c198ed2d8c0be1319018c778e1",
|
||||
"sha256:ca1bd81f40adc59011f58159e4aa6445fc585a32bb8ac9badf7a2c1aa23822f2",
|
||||
"sha256:d5d8555d9bfc3f02385c1c37e9f998e2011f0db4f90e250e5bc0c0a85a813085",
|
||||
"sha256:e55e22ac0a30023426564b1059b035973ec82186ddddbac867078435801c7801",
|
||||
"sha256:e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4",
|
||||
"sha256:ecbb7b01409e9b782df5ded849c178a0aa7c906cf8c5a67368047daab282b184",
|
||||
"sha256:ed01918d545a38998bfa5902c7c00e0fee90e957ce036a4000a88e3fe2264917",
|
||||
"sha256:edabd457cd23a02965166026fd9bfd196f4324fe6032e866d0f3bd0301cd486f",
|
||||
"sha256:fdf1c1dc5bafc32bc5d08b054f94d659422b05aba244d6be4ddc1c72d9aa70fb"
|
||||
],
|
||||
"version": "==1.11.5"
|
||||
},
|
||||
"cryptography": {
|
||||
"hashes": [
|
||||
"sha256:02602e1672b62e803e08617ec286041cc453e8d43f093a5f4162095506bc0beb",
|
||||
"sha256:10b48e848e1edb93c1d3b797c83c72b4c387ab0eb4330aaa26da8049a6cbede0",
|
||||
"sha256:17db09db9d7c5de130023657be42689d1a5f60502a14f6f745f6f65a6b8195c0",
|
||||
"sha256:227da3a896df1106b1a69b1e319dce218fa04395e8cc78be7e31ca94c21254bc",
|
||||
"sha256:2cbaa03ac677db6c821dac3f4cdfd1461a32d0615847eedbb0df54bb7802e1f7",
|
||||
"sha256:31db8febfc768e4b4bd826750a70c79c99ea423f4697d1dab764eb9f9f849519",
|
||||
"sha256:4a510d268e55e2e067715d728e4ca6cd26a8e9f1f3d174faf88e6f2cb6b6c395",
|
||||
"sha256:6a88d9004310a198c474d8a822ee96a6dd6c01efe66facdf17cb692512ae5bc0",
|
||||
"sha256:76936ec70a9b72eb8c58314c38c55a0336a2b36de0c7ee8fb874a4547cadbd39",
|
||||
"sha256:7e3b4aecc4040928efa8a7cdaf074e868af32c58ffc9bb77e7bf2c1a16783286",
|
||||
"sha256:8168bcb08403ef144ff1fb880d416f49e2728101d02aaadfe9645883222c0aa5",
|
||||
"sha256:8229ceb79a1792823d87779959184a1bf95768e9248c93ae9f97c7a2f60376a1",
|
||||
"sha256:8a19e9f2fe69f6a44a5c156968d9fc8df56d09798d0c6a34ccc373bb186cee86",
|
||||
"sha256:8d10113ca826a4c29d5b85b2c4e045ffa8bad74fb525ee0eceb1d38d4c70dfd6",
|
||||
"sha256:be495b8ec5a939a7605274b6e59fbc35e76f5ad814ae010eb679529671c9e119",
|
||||
"sha256:dc2d3f3b1548f4d11786616cf0f4415e25b0fbecb8a1d2cd8c07568f13fdde38",
|
||||
"sha256:e4aecdd9d5a3d06c337894c9a6e2961898d3f64fe54ca920a72234a3de0f9cb3",
|
||||
"sha256:e79ab4485b99eacb2166f3212218dd858258f374855e1568f728462b0e6ee0d9",
|
||||
"sha256:f995d3667301e1754c57b04e0bae6f0fa9d710697a9f8d6712e8cca02550910f"
|
||||
],
|
||||
"version": "==2.3.1"
|
||||
},
|
||||
"enum34": {
|
||||
"hashes": [
|
||||
"sha256:2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850",
|
||||
"sha256:644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a",
|
||||
"sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79",
|
||||
"sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1"
|
||||
],
|
||||
"markers": "python_version < '3'",
|
||||
"version": "==1.1.6"
|
||||
},
|
||||
"idna": {
|
||||
"hashes": [
|
||||
"sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
|
||||
"sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
|
||||
],
|
||||
"version": "==2.7"
|
||||
},
|
||||
"ipaddress": {
|
||||
"hashes": [
|
||||
"sha256:64b28eec5e78e7510698f6d4da08800a5c575caa4a286c93d651c5d3ff7b6794",
|
||||
"sha256:b146c751ea45cad6188dd6cf2d9b757f6f4f8d6ffb96a023e6f2e26eea02a72c"
|
||||
],
|
||||
"markers": "python_version < '3'",
|
||||
"version": "==1.0.22"
|
||||
},
|
||||
"jinja2": {
|
||||
"hashes": [
|
||||
"sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
|
||||
"sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
|
||||
],
|
||||
"version": "==2.10"
|
||||
},
|
||||
"markupsafe": {
|
||||
"hashes": [
|
||||
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
|
||||
],
|
||||
"version": "==1.0"
|
||||
},
|
||||
"paramiko": {
|
||||
"hashes": [
|
||||
"sha256:3c16b2bfb4c0d810b24c40155dbfd113c0521e7e6ee593d704e84b4c658a1f3b",
|
||||
"sha256:a8975a7df3560c9f1e2b43dc54ebd40fd00a7017392ca5445ce7df409f900fcb"
|
||||
],
|
||||
"version": "==2.4.2"
|
||||
},
|
||||
"pyasn1": {
|
||||
"hashes": [
|
||||
"sha256:0ad0fe0593dde1e599cac0bf65bb1a4ec663032f0bc68ee44850db4251e8c501",
|
||||
"sha256:13794d835643ee970b2c059dbfe4eb5d751e16c693c8baee61c526abd209e5c7",
|
||||
"sha256:49a8ed515f26913049113820b462f698e6ed26df62c389dafb6fa3685ddca8de",
|
||||
"sha256:74ac8521a0480f228549be20bea555ae35678f0e754c2fbc6f1576b0959bec43",
|
||||
"sha256:89399ca8ecd4524f974e926d4ef9e7a787903e01f0a9cdff3131ad1361792fe5",
|
||||
"sha256:8f291e0338d519a1a0d07f0b9d03c9265f6be26eb32fdd21af6d3259d14ea49c",
|
||||
"sha256:b9d3abc5031e61927c82d4d96c1cec1e55676c1a991623cfed28faea73cdd7ca",
|
||||
"sha256:d3bbd726c1a760d4ca596a4d450c380b81737612fe0182f5bb3caebc17461fd9",
|
||||
"sha256:dea873d6c907c1cf1341fd88742a61efce33227d7743cb37564ab7d7e77dd9fd",
|
||||
"sha256:ded5eea5cb88bc1ce9aa074b5a3092f95ce4741887e317e9b49c7ece75d7ea0e",
|
||||
"sha256:e8b69ea2200d42201cbedd486eedb8980f320d4534f83ce2fb468e96aa5545d0",
|
||||
"sha256:edad117649643230493aeb4955456ce19ab4b12e94489dde6f7094cdb5a3c87e",
|
||||
"sha256:f58f2a3d12fd754aa123e9fa74fb7345333000a035f3921dbdaa08597aa53137"
|
||||
],
|
||||
"version": "==0.4.4"
|
||||
},
|
||||
"pycparser": {
|
||||
"hashes": [
|
||||
"sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3"
|
||||
],
|
||||
"version": "==2.19"
|
||||
},
|
||||
"pynacl": {
|
||||
"hashes": [
|
||||
"sha256:05c26f93964373fc0abe332676cb6735f0ecad27711035b9472751faa8521255",
|
||||
"sha256:0c6100edd16fefd1557da078c7a31e7b7d7a52ce39fdca2bec29d4f7b6e7600c",
|
||||
"sha256:0d0a8171a68edf51add1e73d2159c4bc19fc0718e79dec51166e940856c2f28e",
|
||||
"sha256:1c780712b206317a746ace34c209b8c29dbfd841dfbc02aa27f2084dd3db77ae",
|
||||
"sha256:2424c8b9f41aa65bbdbd7a64e73a7450ebb4aa9ddedc6a081e7afcc4c97f7621",
|
||||
"sha256:2d23c04e8d709444220557ae48ed01f3f1086439f12dbf11976e849a4926db56",
|
||||
"sha256:30f36a9c70450c7878053fa1344aca0145fd47d845270b43a7ee9192a051bf39",
|
||||
"sha256:37aa336a317209f1bb099ad177fef0da45be36a2aa664507c5d72015f956c310",
|
||||
"sha256:4943decfc5b905748f0756fdd99d4f9498d7064815c4cf3643820c9028b711d1",
|
||||
"sha256:57ef38a65056e7800859e5ba9e6091053cd06e1038983016effaffe0efcd594a",
|
||||
"sha256:5bd61e9b44c543016ce1f6aef48606280e45f892a928ca7068fba30021e9b786",
|
||||
"sha256:6482d3017a0c0327a49dddc8bd1074cc730d45db2ccb09c3bac1f8f32d1eb61b",
|
||||
"sha256:7d3ce02c0784b7cbcc771a2da6ea51f87e8716004512493a2b69016326301c3b",
|
||||
"sha256:a14e499c0f5955dcc3991f785f3f8e2130ed504fa3a7f44009ff458ad6bdd17f",
|
||||
"sha256:a39f54ccbcd2757d1d63b0ec00a00980c0b382c62865b61a505163943624ab20",
|
||||
"sha256:aabb0c5232910a20eec8563503c153a8e78bbf5459490c49ab31f6adf3f3a415",
|
||||
"sha256:bd4ecb473a96ad0f90c20acba4f0bf0df91a4e03a1f4dd6a4bdc9ca75aa3a715",
|
||||
"sha256:e2da3c13307eac601f3de04887624939aca8ee3c9488a0bb0eca4fb9401fc6b1",
|
||||
"sha256:f67814c38162f4deb31f68d590771a29d5ae3b1bd64b75cf232308e5c74777e0"
|
||||
],
|
||||
"version": "==1.3.0"
|
||||
},
|
||||
"pyyaml": {
|
||||
"hashes": [
|
||||
"sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b",
|
||||
"sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf",
|
||||
"sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a",
|
||||
"sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3",
|
||||
"sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1",
|
||||
"sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1",
|
||||
"sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613",
|
||||
"sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04",
|
||||
"sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f",
|
||||
"sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537",
|
||||
"sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531"
|
||||
],
|
||||
"version": "==3.13"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
|
||||
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
|
||||
],
|
||||
"version": "==1.11.0"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
40
README.md
Normal file
40
README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# kubernetes-ansible
|
||||
Deploy kubernetes with kubeadm with ansible. This currently only supports a single master kubernetes cluster. This currently only deploys weave net for pod networking.
|
||||
|
||||
# Deploy
|
||||
|
||||
### Requirements
|
||||
1. Python
|
||||
2. Pip
|
||||
3. Pipenv
|
||||
5. Nodes already deployed and running.
|
||||
6. SSH access to all nodes you're deploying to.
|
||||
* You will need to define and environment variable for your ssh key. `export PRIVATE_KEY="/location/of/key"`
|
||||
* OR you will need a ssh agent running.
|
||||
|
||||
### Steps
|
||||
1. Copy hosts.example to hosts
|
||||
* Put ip addresses under the sections.
|
||||
* Master is a single node used for the kubernetes api. See kubernetes documentation for more info on masters: https://kubernetes.io/docs/concepts/overview/components/
|
||||
* Workers are nodes used for running containers. You can have as many as necessary.
|
||||
2. Copy group_vars/all.example to group_vars/all
|
||||
* Fill out with the settings that pertain to your configuration.
|
||||
3. Run `bash supporting-scripts/run-setup.sh`
|
||||
|
||||
# Lab environment
|
||||
|
||||
You can easily run a lab environment with Vagrant.
|
||||
|
||||
### Requirements
|
||||
1. Install [Virtualbox](https://www.virtualbox.org/)
|
||||
2. Install [Vagrant](https://www.vagrantup.com/)
|
||||
|
||||
### Steps
|
||||
1. Run `vagrant up` - This will deploy 5 machines. A "client" node for running the deploy with ansible. A master node and 3 worker nodes.
|
||||
2. Run `vagrant ssh client -c 'bash /vagrant/tests/files/test-deploy.sh'`
|
||||
3. Run `vagrant ssh master` then run `kubectl` commands like `kubectl get nodes` or `kubectl get pods --all-namespaces`
|
||||
4. Kubernetes nodes will be running on a host-only network that you can access from your machine with ips 192.168.254.2-5.
|
||||
|
||||
To see what is going on, this has deployed Traefik as an ingress controller to the swarm. To get Traefik's port, run `kubectl get services -n kube-system` on the master. Then navigate to http://192.168.254.2:traefikport on your browser.
|
||||
|
||||
To destroy these machines, run `vagrant destroy -f`.
|
||||
58
Vagrantfile
vendored
Normal file
58
Vagrantfile
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.define "master" do |master|
|
||||
master.vm.box = "ubuntu/bionic64"
|
||||
master.vm.hostname = "master"
|
||||
master.vm.network "private_network", ip: "192.168.254.2"
|
||||
master.vm.provision :shell, path: "tests/files/provision-script.sh"
|
||||
master.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "worker1" do |worker1|
|
||||
worker1.vm.box = "ubuntu/bionic64"
|
||||
worker1.vm.hostname = "worker1"
|
||||
worker1.vm.network "private_network", ip: "192.168.254.3"
|
||||
worker1.vm.provision :shell, path: "tests/files/provision-script.sh"
|
||||
worker1.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "worker2" do |worker2|
|
||||
worker2.vm.box = "ubuntu/bionic64"
|
||||
worker2.vm.hostname = "worker2"
|
||||
worker2.vm.network "private_network", ip: "192.168.254.4"
|
||||
worker2.vm.provision :shell, path: "tests/files/provision-script.sh"
|
||||
worker2.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "worker3" do |worker3|
|
||||
worker3.vm.box = "ubuntu/bionic64"
|
||||
worker3.vm.hostname = "worker3"
|
||||
worker3.vm.network "private_network", ip: "192.168.254.5"
|
||||
worker3.vm.provision :shell, path: "tests/files/provision-script.sh"
|
||||
worker3.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "client" do |client|
|
||||
client.vm.box = "ubuntu/bionic64"
|
||||
client.vm.hostname = "client"
|
||||
client.vm.network "private_network", ip: "192.168.254.6"
|
||||
client.vm.provision :shell, path: "tests/files/install-pip.sh"
|
||||
client.vm.provision :shell, path: "tests/files/provision-script.sh"
|
||||
client.vm.provider "virtualbox" do |v|
|
||||
v.memory = 512
|
||||
v.cpus = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
2
group_vars/all.example
Normal file
2
group_vars/all.example
Normal file
@@ -0,0 +1,2 @@
|
||||
docker_ce_version_to_install: 18.03.1
|
||||
kube_init_network_interface: enp0s8
|
||||
6
hosts.example
Normal file
6
hosts.example
Normal file
@@ -0,0 +1,6 @@
|
||||
[masters]
|
||||
192.168.254.2
|
||||
[workers]
|
||||
192.168.254.3
|
||||
192.168.254.4
|
||||
192.168.254.5
|
||||
55
playbooks/site.yml
Normal file
55
playbooks/site.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
- name: Setup ansible dependencies
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
serial: 100%
|
||||
tasks:
|
||||
- include: ../roles/ansible-dependencies/tasks/main.yml
|
||||
|
||||
- name: Install kubernetes
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
serial: 100%
|
||||
tasks:
|
||||
- include: ../roles/install-kubernetes/tasks/main.yml
|
||||
|
||||
- name: Bootstrap kubernetes
|
||||
hosts: masters[0]
|
||||
gather_facts: yes
|
||||
serial: 100%
|
||||
tasks:
|
||||
- name: Set interface var name fact
|
||||
set_fact:
|
||||
kube_interface_var_name: "ansible_{{ kube_init_network_interface }}"
|
||||
|
||||
- name: Set swarm advertise ip address
|
||||
set_fact:
|
||||
init_ip: "{{ hostvars[inventory_hostname][kube_interface_var_name]['ipv4']['address'] }}"
|
||||
|
||||
- include: ../roles/initialize-kubernetes/tasks/main.yml
|
||||
vars:
|
||||
join_addr: "{{ init_ip }}"
|
||||
|
||||
- name: Join worker nodes
|
||||
hosts: workers
|
||||
gather_facts: yes
|
||||
serial: 100%
|
||||
# vars:
|
||||
# join-ip:
|
||||
# "{{ hostvars[groups['masters'][0]]['join-ip']['stdout'] }}"
|
||||
# init-ip:
|
||||
# "{{ hostvars[groups['masters'][0]]['init-ip'] }}"
|
||||
tasks:
|
||||
- name: Set interface var name fact
|
||||
set_fact:
|
||||
kube_interface_var_name: "ansible_{{ kube_init_network_interface }}"
|
||||
|
||||
- name: Set swarm advertise ip address
|
||||
set_fact:
|
||||
kube_interface_ip: "{{ hostvars[inventory_hostname][kube_interface_var_name]['ipv4']['address'] }}"
|
||||
|
||||
- include: ../roles/join-kubernetes-workers/tasks/main.yml
|
||||
vars:
|
||||
join_addr: "{{ hostvars[groups['masters'][0]]['init_ip'] }}"
|
||||
join_token: "{{ hostvars[groups['masters'][0]]['join_token']['stdout'] }}"
|
||||
kube_ip: "{{ kube_interface_ip }}"
|
||||
14
roles/ansible-dependencies/tasks/main.yml
Normal file
14
roles/ansible-dependencies/tasks/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Install package dependencies
|
||||
raw: apt-get update -qq && apt-get install -y python-simplejson python-urllib3 python-openssl python-pyasn1 python-pip ca-certificates
|
||||
become: true
|
||||
|
||||
- name: Install pip dependencies
|
||||
raw: pip install ndg-httpsclient
|
||||
ignore_errors: true
|
||||
become: true
|
||||
|
||||
- name: Install pip dependencies again because it fails sometimes
|
||||
raw: pip install ndg-httpsclient
|
||||
ignore_errors: true
|
||||
become: true
|
||||
4
roles/initialize-kubernetes/files/install-pod-network.sh
Normal file
4
roles/initialize-kubernetes/files/install-pod-network.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
|
||||
#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml
|
||||
60
roles/initialize-kubernetes/tasks/main.yml
Normal file
60
roles/initialize-kubernetes/tasks/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
- name: Initialize kubernetes
|
||||
command: kubeadm init --apiserver-advertise-address={{ join_addr }} --pod-network-cidr=10.244.0.0/16
|
||||
register: out
|
||||
failed_when: "out.rc != 0 and '/etc/kubernetes/manifests/kube-apiserver.yaml already exists' not in out.stderr"
|
||||
changed_when: "out.rc == 0 and '/etc/kubernetes/manifests/kube-apiserver.yaml already exists' not in out.stderr"
|
||||
become: true
|
||||
|
||||
- name: Get join token
|
||||
command: >
|
||||
bash -c 'kubeadm token list | grep -v TOKEN | cut -d " " -f 1'
|
||||
become: true
|
||||
register: join_token_reg
|
||||
changed_when: join_token_reg.rc == 0
|
||||
|
||||
- name: Set join facts
|
||||
set_fact:
|
||||
join_token: "{{ join_token_reg }}"
|
||||
init_ip: "{{ join_addr }}"
|
||||
|
||||
- name: Copy admin file
|
||||
shell: >
|
||||
cp /etc/kubernetes/admin.conf {{ ansible_env.HOME }}/admin.conf && \
|
||||
chown {{ ansible_user_id }}:{{ ansible_user_id }} {{ ansible_env.HOME }}/admin.conf
|
||||
become: true
|
||||
|
||||
- name: Set KUBECONFIG
|
||||
lineinfile:
|
||||
path: "{{ ansible_env.HOME }}/.bashrc"
|
||||
regexp: '^export\ KUBECONFIG='
|
||||
line: 'export KUBECONFIG={{ ansible_env.HOME }}/admin.conf'
|
||||
|
||||
- name: Copy pod network install script
|
||||
copy:
|
||||
src: ../files/install-pod-network.sh
|
||||
dest: "{{ ansible_env.HOME }}/install-pod-network.sh"
|
||||
|
||||
- name: Copy networking yaml
|
||||
template:
|
||||
src: ../templates/kube-flannel.yml.j2
|
||||
dest: "{{ ansible_env.HOME }}/kube-flannel.yml"
|
||||
|
||||
- name: Install Pod Network
|
||||
shell: >
|
||||
bash {{ ansible_env.HOME }}/install-pod-network.sh
|
||||
#kubectl apply -f {{ ansible_env.HOME }}/kube-flannel.yml
|
||||
environment:
|
||||
KUBECONFIG: "{{ ansible_env.HOME }}/admin.conf"
|
||||
|
||||
- name: Install Kubernetes Dashboard
|
||||
shell: kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
|
||||
environment:
|
||||
KUBECONFIG: "{{ ansible_env.HOME }}/admin.conf"
|
||||
ignore_errors: true
|
||||
|
||||
- name: Install Traefik Ingress Controller
|
||||
shell: >
|
||||
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-deployment.yaml
|
||||
environment:
|
||||
KUBECONFIG: "{{ ansible_env.HOME }}/admin.conf"
|
||||
475
roles/initialize-kubernetes/templates/kube-flannel.yml.j2
Normal file
475
roles/initialize-kubernetes/templates/kube-flannel.yml.j2
Normal file
@@ -0,0 +1,475 @@
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: flannel
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes/status
|
||||
verbs:
|
||||
- patch
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: flannel
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: flannel
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: flannel
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: flannel
|
||||
namespace: kube-system
|
||||
---
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-flannel-cfg
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
data:
|
||||
cni-conf.json: |
|
||||
{
|
||||
"name": "cbr0",
|
||||
"plugins": [
|
||||
{
|
||||
"type": "flannel",
|
||||
"delegate": {
|
||||
"hairpinMode": true,
|
||||
"isDefaultGateway": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "portmap",
|
||||
"capabilities": {
|
||||
"portMappings": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
net-conf.json: |
|
||||
{
|
||||
"Network": "10.244.0.0/16",
|
||||
"Backend": {
|
||||
"Type": "vxlan"
|
||||
}
|
||||
}
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-amd64
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: amd64
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: flannel
|
||||
initContainers:
|
||||
- name: install-cni
|
||||
image: quay.io/coreos/flannel:v0.10.0-amd64
|
||||
command:
|
||||
- cp
|
||||
args:
|
||||
- -f
|
||||
- /etc/kube-flannel/cni-conf.json
|
||||
- /etc/cni/net.d/10-flannel.conflist
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-amd64
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface={{ kube_init_network_interface }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
volumes:
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-arm64
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: arm64
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: flannel
|
||||
initContainers:
|
||||
- name: install-cni
|
||||
image: quay.io/coreos/flannel:v0.10.0-arm64
|
||||
command:
|
||||
- cp
|
||||
args:
|
||||
- -f
|
||||
- /etc/kube-flannel/cni-conf.json
|
||||
- /etc/cni/net.d/10-flannel.conflist
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-arm64
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface={{ kube_init_network_interface }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
volumes:
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-arm
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: arm
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: flannel
|
||||
initContainers:
|
||||
- name: install-cni
|
||||
image: quay.io/coreos/flannel:v0.10.0-arm
|
||||
command:
|
||||
- cp
|
||||
args:
|
||||
- -f
|
||||
- /etc/kube-flannel/cni-conf.json
|
||||
- /etc/cni/net.d/10-flannel.conflist
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-arm
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface={{ kube_init_network_interface }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
volumes:
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-ppc64le
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: ppc64le
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: flannel
|
||||
initContainers:
|
||||
- name: install-cni
|
||||
image: quay.io/coreos/flannel:v0.10.0-ppc64le
|
||||
command:
|
||||
- cp
|
||||
args:
|
||||
- -f
|
||||
- /etc/kube-flannel/cni-conf.json
|
||||
- /etc/cni/net.d/10-flannel.conflist
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-ppc64le
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface={{ kube_init_network_interface }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
volumes:
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-s390x
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: s390x
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: flannel
|
||||
initContainers:
|
||||
- name: install-cni
|
||||
image: quay.io/coreos/flannel:v0.10.0-s390x
|
||||
command:
|
||||
- cp
|
||||
args:
|
||||
- -f
|
||||
- /etc/kube-flannel/cni-conf.json
|
||||
- /etc/cni/net.d/10-flannel.conflist
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-s390x
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface={{ kube_init_network_interface }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
volumes:
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
69
roles/install-kubernetes/tasks/main.yml
Normal file
69
roles/install-kubernetes/tasks/main.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- name: Update apt
|
||||
apt: update_cache=yes
|
||||
become: true
|
||||
|
||||
- name: Install programs to add debian repositories
|
||||
apt: name={{ item }} state=present force=yes
|
||||
with_items:
|
||||
- curl
|
||||
- apt-transport-https
|
||||
become: true
|
||||
|
||||
- name: Add kubernetes key
|
||||
apt_key:
|
||||
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Add kubernetes repo
|
||||
apt_repository:
|
||||
repo: deb https://apt.kubernetes.io/ kubernetes-xenial main
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Add docker key
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Add docker repo
|
||||
apt_repository:
|
||||
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Update apt
|
||||
apt: update_cache=yes
|
||||
become: true
|
||||
|
||||
- name: Install kubelet kubeadm and kubectl
|
||||
apt: name={{ item }} state=present force=yes
|
||||
with_items:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
become: true
|
||||
|
||||
- name: Install docker-ce
|
||||
shell: >
|
||||
apt-get install -y -qq docker-ce=$(apt-cache madison docker-ce | grep "{{ docker_ce_version_to_install }}" | awk {'print $3'})
|
||||
become: true
|
||||
|
||||
- name: apt-mark hold kubelet kubeadm and kubectl
|
||||
command: apt-mark hold {{ item }}
|
||||
with_items:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
become: true
|
||||
|
||||
- name: Set bridge-nf-call-iptables
|
||||
sysctl:
|
||||
name: net.bridge.bridge-nf-call-iptables
|
||||
value: 1
|
||||
state: present
|
||||
sysctl_set: yes
|
||||
reload: yes
|
||||
become: true
|
||||
27
roles/join-kubernetes-workers/tasks/main.yml
Normal file
27
roles/join-kubernetes-workers/tasks/main.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: Join kubernetes cluster
|
||||
command: kubeadm join --discovery-token-unsafe-skip-ca-verification --token={{ join_token }} {{ join_addr }}:6443
|
||||
register: out
|
||||
changed_when: "out.rc == 0 and '/etc/kubernetes/bootstrap-kubelet.conf already exists' not in out.stderr"
|
||||
failed_when: "out.rc != 0 and '/etc/kubernetes/bootstrap-kubelet.conf already exists' not in out.stderr"
|
||||
become: true
|
||||
|
||||
- name: Set kublet node ip
|
||||
replace:
|
||||
path: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
|
||||
regexp: 'ExecStart=\/usr\/bin\/kubelet\ \$KUBELET_KUBECONFIG_ARGS'
|
||||
replace: 'ExecStart=/usr/bin/kubelet --node-ip={{ kube_ip }} $KUBELET_KUBECONFIG_ARGS'
|
||||
backup: yes
|
||||
register: kubeletip
|
||||
become: true
|
||||
|
||||
- name: Force systemd to reread configs
|
||||
command: systemctl daemon-reload
|
||||
become: true
|
||||
when: kubeletip.changed
|
||||
|
||||
- name: Restart kubelet service
|
||||
command: service kubelet restart
|
||||
become: true
|
||||
when: kubeletip.changed
|
||||
|
||||
11
supporting-scripts/run-setup.sh
Normal file
11
supporting-scripts/run-setup.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# cd to project directory
|
||||
script_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
|
||||
project_dir="${script_dir}/../"
|
||||
private_key=${PRIVATE_KEY}
|
||||
|
||||
cd ${project_dir}
|
||||
|
||||
# Run
|
||||
pipenv install
|
||||
pipenv run ansible-playbook -u ${DEPLOY_USER} -i hosts --ssh-common-args="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" --private-key=${private_key} playbooks/site.yml
|
||||
2
tests/files/group_vars_all
Normal file
2
tests/files/group_vars_all
Normal file
@@ -0,0 +1,2 @@
|
||||
docker_ce_version_to_install: 18.03.1
|
||||
kube_init_network_interface: enp0s8
|
||||
10
tests/files/install-pip.sh
Normal file
10
tests/files/install-pip.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq \
|
||||
python-dev \
|
||||
python-pip \
|
||||
python-setuptools
|
||||
|
||||
pip install --upgrade setuptools
|
||||
pip install ez_setup
|
||||
pip install pipenv
|
||||
9
tests/files/provision-script.sh
Normal file
9
tests/files/provision-script.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Putting test_rsa.pub into root and vagrant authorized keys
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYa9zstumlg7XkKoNrJMlIN/zteqMA9J4GjuZA7r0xfMPrz4CglxzYKd/BhBpwp/HhU+vSR6vBa15kRODHdPZ+T1oXzMXAmMT3R2ZJRqF280Hsx9sK0X+FZWM84e4a1zQUrxuWyWJ4kKIiaX6DBAmhy8zHNvQ0c4Nk1exfwRicojaze71qrexSas4FHWaI4usC/g3mMKfiML/QX0UWW/G+D8qrg3cK3zClG916XlY/p1h9SWantqz75ea33TtmDNW6iCraKSjVeDGfzhshJsmQ7+/Rr/L4/s7hdpwTqdjSlJTIi61eBxcpDfMWBmsHOMZgnsTZ3wrdYXo70k44moA7 vagrant@test" >> /home/vagrant/.ssh/authorized_keys
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYa9zstumlg7XkKoNrJMlIN/zteqMA9J4GjuZA7r0xfMPrz4CglxzYKd/BhBpwp/HhU+vSR6vBa15kRODHdPZ+T1oXzMXAmMT3R2ZJRqF280Hsx9sK0X+FZWM84e4a1zQUrxuWyWJ4kKIiaX6DBAmhy8zHNvQ0c4Nk1exfwRicojaze71qrexSas4FHWaI4usC/g3mMKfiML/QX0UWW/G+D8qrg3cK3zClG916XlY/p1h9SWantqz75ea33TtmDNW6iCraKSjVeDGfzhshJsmQ7+/Rr/L4/s7hdpwTqdjSlJTIi61eBxcpDfMWBmsHOMZgnsTZ3wrdYXo70k44moA7 vagrant@test" >> /root/.ssh/authorized_keys
|
||||
|
||||
cp /vagrant/tests/files/test_rsa /home/vagrant/test_rsa
|
||||
chmod 600 /home/vagrant/test_rsa
|
||||
chown vagrant:vagrant /home/vagrant/test_rsa
|
||||
11
tests/files/test-deploy.sh
Normal file
11
tests/files/test-deploy.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
script_dir="$( dirname $(readlink -f ${BASH_SOURCE[0]}))"
|
||||
project_dir=${script_dir}/../..
|
||||
cd $project_dir
|
||||
|
||||
export PRIVATE_KEY=/home/vagrant/test_rsa;
|
||||
export DEPLOY_USER=vagrant
|
||||
|
||||
cp tests/files/hosts hosts
|
||||
cp tests/files/group_vars_all group_vars/all
|
||||
bash supporting-scripts/run-setup.sh
|
||||
27
tests/files/test_rsa
Normal file
27
tests/files/test_rsa
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEA2Gvc7LbppYO15CqDayTJSDf87XqjAPSeBo7mQO69MXzD68+A
|
||||
oJcc2CnfwYQacKfx4VPr0kerwWteZETgx3T2fk9aF8zFwJjE90dmSUahdvNB7Mfb
|
||||
CtF/hWVjPOHuGtc0FK8blslieJCiIml+gwQJocvMxzb0NHODZNXsX8EYnKI2s3u9
|
||||
aq3sUmrOBR1miOLrAv4N5jCn4jC/0F9FFlvxvg/Kq4N3Ct8wpRvdel5WP6dYfUlm
|
||||
p7as++Xmt907ZgzVuogq2iko1Xgxn84bISbJkO/v0a/y+P7O4XacE6nY0pSUyIut
|
||||
XgcXKQ3zFgZrBzjGYJ7E2d8K3WF6O9JOOJqAOwIDAQABAoIBAGYur1W4myKByHyd
|
||||
MgWBjeOiQ7Jgp9vIo2AXUlGwJvXZoauSAnpQPtc1FieJVu5/7S1lcT+MhWTCbAPN
|
||||
nY+vAr7qenAoR+pCdyUFuh640X2XJzZDuoEmHx59m1hgmApmN3nYn58XIH4qU9MJ
|
||||
mikD3ARfdCVPJggpzgzrEDq5sgQpmEZnVhAj7j4pdwnbNgt7sTzpltiQvrdcUx/v
|
||||
uUEoTRkdUJhwaJ8aItl958aGKq7wopd6c8zsuBLQlIDI1O/CNg7NrE47pvMkMpHo
|
||||
eXXVGPA0wVHbDejhEKXnQCAW0W/k2J3BDJhoZG15FErDmRg25oInmT27U15LZ9YI
|
||||
TKwzWqECgYEA9nuUL8RIkmTX+fJF3djfrKn4KWWF9qUbEHzx78byeK2WxP1magfZ
|
||||
m4gVIbg+f6q6ix0/VvkA992kDTcnZGFi7iAWBi5j8XE8iDQCFvOdMXLDi9KqL/ID
|
||||
XE2SbpwnKBZm1tf+a6U5nlHsZWkGn1qaESFqmSjJ0/lDeqdQ+bjTMusCgYEA4Mci
|
||||
euHbIn8NoqE9UAbCmTVIrS2MbSYPUZZmh/GSaC70024nGjQVl3dQiYC7nTBrKfPC
|
||||
H3CfcbHhUpqek+imLukaJdR7yAB5AJRE+hLcHR/0Zqe2JmgLZOK8ikPvdGzeY4Qb
|
||||
wtKVDtPkW6HMT+p4lCleppJs+fyCOEG2oQO4c/ECgYAFJwwv+3Bw7v680N25B4GV
|
||||
gHAZnW+xej4YmCQOmSAUebx/HbT4XnWkFLIsZEeaL516rv/V95qXk+CMDi0aohaJ
|
||||
V85eDrY0I+PaDQxGIo2UrQt9bsfz/KEpWs3G1ijTY7R+pUFCSs/riVbhv9JNnn0+
|
||||
Am7SCNI/RiSs+bZtofl4RQKBgC2yzqPE/1RIGHGT7m8ysKWNW7U5qW8Xac3gkf/Z
|
||||
cTaVNVk27+Q36pvcuhb6gSo4CdGBqVnS/9eRnom4vby8c+zdn19Jj9Ddp7wiaNOe
|
||||
ufmB4aJtPm8YgBiGsGY74Zb9+0ioNyyou31EPw0SHAOzW8hjkMa0xksctyzQz1x0
|
||||
8S9BAoGBAKBt52EG2N5AdqAL2rFods7+J+wSZ09IOF4YVTMqDxow/QyHOPRB5tbk
|
||||
p1TBlXb0p54A+C9cEKjT+/y5Bhf5sz1afUVlqkczcC2i5jiKW9A5dWCOQKe5C3nl
|
||||
z4gkcWMFwz0PY60BCbdk13pKUcJX6M/Tluf7xuYl2t59C0CXN5WH
|
||||
-----END RSA PRIVATE KEY-----
|
||||
1
tests/files/test_rsa.pub
Normal file
1
tests/files/test_rsa.pub
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYa9zstumlg7XkKoNrJMlIN/zteqMA9J4GjuZA7r0xfMPrz4CglxzYKd/BhBpwp/HhU+vSR6vBa15kRODHdPZ+T1oXzMXAmMT3R2ZJRqF280Hsx9sK0X+FZWM84e4a1zQUrxuWyWJ4kKIiaX6DBAmhy8zHNvQ0c4Nk1exfwRicojaze71qrexSas4FHWaI4usC/g3mMKfiML/QX0UWW/G+D8qrg3cK3zClG916XlY/p1h9SWantqz75ea33TtmDNW6iCraKSjVeDGfzhshJsmQ7+/Rr/L4/s7hdpwTqdjSlJTIi61eBxcpDfMWBmsHOMZgnsTZ3wrdYXo70k44moA7 vagrant@test
|
||||
3
wordpress.sh
Normal file
3
wordpress.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
kubectl run wordpress --image=tutum/wordpress --port=80
|
||||
wordpress_pod=$(kubectl get pods | grep wordpress | awk {'print $1'})
|
||||
kubectl expose pod ${wordpress_pod} --name=wordpress --type=NodePort
|
||||
Reference in New Issue
Block a user