Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
start a development guide for min-turnup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedanese committed Jun 10, 2016
1 parent 999c5e0 commit aef85dd
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 258 deletions.
19 changes: 19 additions & 0 deletions min-turnup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# a big docker file meant for depolying min-turnup
FROM ubuntu

RUN apt-get update
RUN apt-get install -y curl vim jq libssl-dev openssl zip make sudo

RUN curl -sSL --fail -o /usr/local/bin/jsonnet \
"https://storage.googleapis.com/kube-deploy/jsonnet/adf169b1e4a4ba170f58b47111ed88552fae42c8"
RUN chmod +x /usr/local/bin/jsonnet

RUN curl -sSL --fail \
"https://releases.hashicorp.com/terraform/0.6.16/terraform_0.6.16_linux_amd64.zip" \
-o /tmp/tf.zip \
&& unzip -d /usr/local/bin /tmp/tf.zip \
&& rm /tmp/tf.zip

WORKDIR /root/min-turnup

CMD bash
59 changes: 59 additions & 0 deletions min-turnup/Documentation/devel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Developing on min-turnup

### How to deploy a cluster

Here is a flow for deploying a min-turnup cluster on GCE.
```
$ # checkout code and enter min-turnup directory
$ cd min-turnup/
$ # build .config.json
$ make config
$ # or
$ make menuconfig
$ make .config.json
$ # mine looks like
$ cat .config.json
{
"phase1": {
"num_nodes": 4,
"instance_prefix": "kuberentes",
"cloud_provider": "gce",
"gce": {
"os_image": "ubuntu-1604-xenial-v20160420c",
"instance_type": "n1-standard-2",
"project": "",
"region": "us-central1",
"zone": "us-central1-b",
"network": ""
}
},
"phase1b": {
"extra_api_sans": "",
"extra_api_dns_names": "kubernetes-master"
},
"phase2": {
"docker_registry": "gcr.io/google-containers",
"kubernetes_version": "v1.2.4"
},
"phase3": {
"run_addons": true,
"kube_proxy": true,
"dashboard": true,
"kube_dns": true,
"elasticsearch": true
}
}
$ # generate and deploy terraform
$ cd phase1/gce/
$ ./gen
$ terraform apply out/
```

The current dependencies are:

* terraform on your path, available [here](https://www.terraform.io/downloads.html).
* jsonnet which needs to be built from source, available [here](https://github.com/google/jsonnet/releases/tag/v0.8.8).
* linux x86_64, other platforms are not yet tested.
* jq
2 changes: 1 addition & 1 deletion min-turnup/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

SHELL=/bin/bash
.SHELLFLAGS="-O extglob -o errexit -o pipefail -o nounset -c"
.SHELLFLAGS="-O" "extglob" "-o" "errexit" "-o" "pipefail" "-o" "nounset" "-c"

.PHONY: config echo-config

Expand Down
1 change: 1 addition & 0 deletions min-turnup/phase1/gce/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
terraform.tfstate
account.json
terraform.tfstate.backup
out/gce.tf
5 changes: 4 additions & 1 deletion min-turnup/phase1/gce/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set -o nounset
ROLE=$(curl \
-H "Metadata-Flavor: Google" \
"metadata/computeMetadata/v1/instance/attributes/k8s-role")
BUCKET=$(curl \
-H "Metadata-Flavor: Google" \
"metadata/computeMetadata/v1/instance/attributes/k8s-deploy-bucket")

mkdir -p /etc/systemd/system/docker.service.d/
cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagtion_flags.conf
Expand All @@ -22,7 +25,7 @@ curl -H 'Metadata-Flavor:Google' \
#TODO: restrict by role
mkdir -p /srv/kubernetes
for bundle in root kubelet apiserver; do
gsutil cp "gs://mikedanese-k8s-kube-deploy-k-0/crypto/${bundle}.tar" - \
gsutil cp "gs://${BUCKET}/crypto/${bundle}.tar" - \
| sudo tar xv -C /srv/kubernetes
done;

Expand Down
4 changes: 3 additions & 1 deletion min-turnup/phase1/gce/gen
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ set -o errexit
set -o pipefail
set -o nounset

jsonnet --multi out/ all.jsonnet
cd "${BASH_SOURCE%/*}"

jsonnet -J ../../ --multi out/ all.jsonnet
5 changes: 5 additions & 0 deletions min-turnup/phase1/gce/lib/gce.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ function(cfg)
local config_metadata_template = std.toString(cfg {
master_ip: "${google_compute_address.%s.address}",
role: "%s",
phase3+: {
addons_config: (import "phase3/all.jsonnet")(cfg),
},
});
{
provider: {
Expand Down Expand Up @@ -119,6 +122,7 @@ function(cfg)
metadata_startup_script: std.escapeStringDollars(importstr "../configure-vm.sh"),
metadata: {
"k8s-role": "master",
"k8s-deploy-bucket": names.release_bucket,
"k8s-config": config_metadata_template % [names.master_ip, "master"],
},
disk: [{
Expand All @@ -136,6 +140,7 @@ function(cfg)
metadata: {
"startup-script": std.escapeStringDollars(importstr "../configure-vm.sh"),
"k8s-role": "node",
"k8s-deploy-bucket": names.release_bucket,
"k8s-config": config_metadata_template % [names.master_ip, "node"],
},
disk: [{
Expand Down
243 changes: 0 additions & 243 deletions min-turnup/phase1/gce/out/gce.tf

This file was deleted.

Loading

0 comments on commit aef85dd

Please sign in to comment.