From 59994a6df113614d35d869ff00a5aaed7a1110ef Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Sat, 12 Dec 2015 19:32:18 +0100 Subject: [PATCH] Quickstart documentation --- README.md | 35 ++++++++++++++-- .../{production => test}/group_vars/all.yml | 41 ++++++++++--------- environments/test/inventory.example | 34 +++++++++++++++ roles/kubernetes/node/defaults/main.yml | 6 +-- 4 files changed, 91 insertions(+), 25 deletions(-) rename environments/{production => test}/group_vars/all.yml (75%) create mode 100644 environments/test/inventory.example diff --git a/README.md b/README.md index e3fae11cb..20ba6a65a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,33 @@ Ansible v1.9.x * [flanneld](https://github.com/coreos/flannel/releases) v0.5.5 * [docker](https://www.docker.com/) v1.9.1 +Quickstart +------------------------- +The following steps will quickly setup a kubernetes cluster with default configuration. +These defaults are good for a test purposes. + +Edit the inventory according to the number of servers +``` +[downloader] +10.115.99.1 + +[kube-master] +10.115.99.31 + +[kube-node] +10.115.99.32 +10.115.99.33 + +[k8s-cluster:children] +kube-node +kube-master +``` + +Run the playbook +``` +ansible-playbook -i environments/production/inventory cluster.yml -u root +``` + Ansible ------------------------- @@ -44,11 +71,10 @@ In node-mesh mode the nodes peers with all the nodes in order to exchange routes [kube-master] 10.99.0.26 - -[etcd] -10.99.0.26 +10.99.0.59 [kube-node] +10.99.0.59 10.99.0.4 10.99.0.5 10.99.0.36 @@ -60,6 +86,7 @@ In node-mesh mode the nodes peers with all the nodes in order to exchange routes 10.99.0.5 local_as=xxxxxxxx [usa] +10.99.0.59 local_as=xxxxxxxx 10.99.0.36 local_as=xxxxxxxx 10.99.0.37 local_as=xxxxxxxx @@ -69,9 +96,11 @@ kube-master [paris:vars] peers=[{"router_id": "10.99.0.2", "as": "65xxx"}, {"router_id": "10.99.0.3", "as": "65xxx"}] +loadbalancer_address="10.99.0.24" [usa:vars] peers=[{"router_id": "10.99.0.34", "as": "65xxx"}, {"router_id": "10.99.0.35", "as": "65xxx"}] +loadbalancer_address="10.99.0.44" ``` ### Playbook diff --git a/environments/production/group_vars/all.yml b/environments/test/group_vars/all.yml similarity index 75% rename from environments/production/group_vars/all.yml rename to environments/test/group_vars/all.yml index 581fa1434..5dc380898 100644 --- a/environments/production/group_vars/all.yml +++ b/environments/test/group_vars/all.yml @@ -5,28 +5,31 @@ bin_dir: /usr/local/bin # Note: ensure that you've enough disk space (about 1G) local_release_dir: "/tmp/releases" +# Cluster Loglevel configuration +kube_log_level: 2 + # Users to create for basic auth in Kubernetes API via HTTP -# kube_users: -# kube: -# pass: changeme -# role: admin +kube_users: + kube: + pass: changeme + role: admin # root: # pass: changeme # role: admin # Kubernetes cluster name, also will be used as DNS domain -# cluster_name: cluster.local +cluster_name: cluster.local # set this variable to calico if needed. keep it empty if flannel is used -# kube_network_plugin: calico +kube_network_plugin: calico # Kubernetes internal network for services, unused block of space. -# kube_service_addresses: 10.233.0.0/18 +kube_service_addresses: 10.233.0.0/18 # internal network. When used, it will assign IP # addresses from this range to individual pods. # This network must be unused in your network infrastructure! -# kube_pods_subnet: 10.233.64.0/18 +kube_pods_subnet: 10.233.64.0/18 # internal network total size (optional). This is the prefix of the # entire network. Must be unused in your environment. @@ -35,17 +38,17 @@ local_release_dir: "/tmp/releases" # internal network node size allocation (optional). This is the size allocated # to each node on your network. With these defaults you should have # room for 4096 nodes with 254 pods per node. -# kube_network_node_prefix: 24 +kube_network_node_prefix: 24 # With calico it is possible to distributed routes with border routers of the datacenter. -# peer_with_router: false +peer_with_router: false # Warning : enabling router peering will disable calico's default behavior ('node mesh'). # The subnets of each nodes will be distributed by the datacenter router # The port the API Server will be listening on. -# kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}" -# kube_apiserver_port: 443 # (https) -# kube_apiserver_insecure_port: 8080 # (http) +kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}" +kube_apiserver_port: 443 # (https) +kube_apiserver_insecure_port: 8080 # (http) # Internal DNS configuration. # Kubernetes can create and mainatain its own DNS server to resolve service names @@ -56,13 +59,13 @@ local_release_dir: "/tmp/releases" # Kubernetes won't do this for you (yet). # Upstream dns servers used by dnsmasq -# upstream_dns_servers: -# - 8.8.8.8 -# - 4.4.8.8 +upstream_dns_servers: + - 8.8.8.8 + - 4.4.8.8 # # # Use dns server : https://github.com/ansibl8s/k8s-skydns/blob/master/skydns-README.md -# dns_setup: true -# dns_domain: "{{ cluster_name }}" +dns_setup: true +dns_domain: "{{ cluster_name }}" # # # Ip address of the kubernetes dns service -# dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address') }}" +dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address') }}" diff --git a/environments/test/inventory.example b/environments/test/inventory.example new file mode 100644 index 000000000..35730d191 --- /dev/null +++ b/environments/test/inventory.example @@ -0,0 +1,34 @@ +[downloader] +10.99.0.26 + +[kube-master] +10.99.0.26 +10.99.0.27 + +[kube-node] +10.99.0.27 +10.99.0.4 +10.99.0.5 +10.99.0.36 +10.99.0.37 + +[paris] +10.99.0.26 +10.99.0.4 local_as=xxxxxxxx +10.99.0.5 local_as=xxxxxxxx + +[usa] +10.99.0.36 local_as=xxxxxxxx +10.99.0.37 local_as=xxxxxxxx + +[k8s-cluster:children] +kube-node +kube-master + +[paris:vars] +peers=[{"router_id": "10.99.0.2", "as": "65xxx"}, {"router_id": "10.99.0.3", "as": "65xxx"}] +loadbalancer_address="10.99.0.24" + +[usa:vars] +peers=[{"router_id": "10.99.0.34", "as": "65xxx"}, {"router_id": "10.99.0.35", "as": "65xxx"}] +loadbalancer_address="10.99.0.44" diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index d48d72b66..209a2420f 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -43,6 +43,6 @@ hyperkube_image: # pick the 10th ip address in the kube_service_addresses range and use that. dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address') }}" -# kube_api_runtime_config: -# - extensions/v1beta1/daemonsets=true -# - extensions/v1beta1/deployments=true +kube_api_runtime_config: + - extensions/v1beta1/daemonsets=true + - extensions/v1beta1/deployments=true