Cloud-config files for setting up k8s single-node cluster with kubeadm on Ubuntu 16.04.3 LTS (Xenial Xerus)
Minimal installation of k8s with kubeadm.
| // example | |
| const fetchUrl = fetchUrlFactory(2) | |
| const { content, headers } = await fetchUrl('https://example.com') | |
| // lib | |
| const https = require('https') | |
| function fetcUrlFactory ({ concurrency }) { | |
| let running = 0 | |
| let queue = [] |
| aws s3 ls \ | |
| | grep -e 'pr.*\.example\.com' \ | |
| | cut -d ' ' -f 3 \ | |
| | xargs -I {} -L 1 aws s3 rb s3://{} --force |
| #!/usr/bin/env bash | |
| set -e | |
| SOURCE_APP=web-app | |
| TARGET_APP=$1 | |
| [ -z "$TARGET_APP" ] \ | |
| && echo "usage: `basename $0` <TARGET_APP>" \ | |
| && exit 1 |
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Dashboard Rotator</title> | |
| <script> | |
| var dashboardDisplayTimeout = 120000; | |
| var dashboards = [{ | |
| name: 'Tab1', | |
| url: 'https://tab1.example.com' | |
| }, { |
| console.log('<RoutingRules>') | |
| ;[ | |
| ['/url1/', '/url2/'], | |
| ['/url11/', '/url22/'] | |
| ].forEach(([source, target]) => console.log(` | |
| <RoutingRule> | |
| <Condition> | |
| <KeyPrefixEquals>${source}</KeyPrefixEquals> | |
| </Condition> |
| const got = require('got') | |
| async function authenticate (endpoint, username, password) { | |
| try { | |
| const response = await got(endpoint, { | |
| json: true, | |
| body: { | |
| username, | |
| password | |
| } |
| #cloud-config | |
| package_upgrade: true | |
| packages: | |
| - docker | |
| - python2-pip | |
| write_files: | |
| - path: /etc/systemd/system/docker.service.d/aws-credentials.conf | |
| content: | | |
| [Service] | |
| Environment="AWS_ACCESS_KEY_ID=<key>" |
| time_namelookup: %{time_namelookup}\n | |
| time_connect: %{time_connect}\n | |
| time_appconnect: %{time_appconnect}\n | |
| time_pretransfer: %{time_pretransfer}\n | |
| time_redirect: %{time_redirect}\n | |
| time_starttransfer: %{time_starttransfer}\n | |
| ----------\n | |
| time_total: %{time_total}\n |
| const AWS = require('aws-sdk') | |
| const s3 = new AWS.S3() | |
| function fetchJson (bucket, key) { | |
| return new Promise((resolve, reject) => { | |
| s3.getObject({ Bucket: bucket, Key: key }, (err, data) => { | |
| if (err) return reject(err) | |
| try { | |
| const bodyString = data.Body.toString('utf8') |