-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0a05733
Showing
80 changed files
with
1,973 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.tar | ||
*.tar.gz | ||
retry_files/ | ||
fact_files/ | ||
.vagrant/ | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ansible, python-netaddr on control machine | ||
|
||
# Deploy k8s cluster | ||
modify inventory/hosts and inventory/group_vars/all.yml | ||
|
||
deploy all components | ||
``` | ||
ansible-playbook deploy-cluster.yml | ||
``` | ||
|
||
or one by one | ||
|
||
``` | ||
ansible-playbook prepare.yml | ||
ansible-playbook deploy-etcd.yml | ||
ansible-playbook deploy-master.yml | ||
ansible-playbook deploy-node.yml | ||
ansible-playbook deploy-addons.yml | ||
``` | ||
|
||
To add more nodes after cluster is up and running, just add new nodes to inventory/hosts and run | ||
``` | ||
ansible-playbook prepare.yml | ||
ansible-playbook deploy-node.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "ubuntu/trusty64" | ||
config.vm.box_check_update = false | ||
|
||
config.vm.define "kube-master" do |s| | ||
s.vm.network "private_network", ip: "10.7.0.10" | ||
s.vm.network "forwarded_port", guest: 80, host: 18080 | ||
s.vm.hostname = "kube-master" | ||
s.vm.provider "virtualbox" do |v| | ||
v.name = "kube-master" | ||
v.memory = 2048 | ||
v.cpus = 1 | ||
end | ||
end | ||
|
||
(1..2).each do |n| | ||
config.vm.define "kube-node#{n}" do |s| | ||
s.vm.network "private_network", ip: "10.7.0.1#{n}" | ||
s.vm.hostname = "kube-node#{n}" | ||
s.vm.provider "virtualbox" do |v| | ||
v.name = "kube-node#{n}" | ||
v.memory = 2048 | ||
v.cpus = 1 | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[defaults] | ||
roles_path = roles | ||
inventory = inventory.ini | ||
transport = ssh | ||
host_key_checking = False | ||
|
||
gathering = explicit | ||
fact_caching = jsonfile | ||
fact_caching_connection = fact_files | ||
retry_files_save_path = retry_files | ||
|
||
timeout = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Deploy kubernetes addons | ||
hosts: masters | ||
become: yes | ||
roles: | ||
- addons | ||
tags: | ||
- addons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- include: prepare.yml | ||
|
||
- include: deploy-etcd.yml | ||
|
||
- include: deploy-master.yml | ||
|
||
- include: deploy-node.yml | ||
|
||
- include: deploy-addons.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Deploy etcd | ||
hosts: etcd | ||
become: yes | ||
roles: | ||
- etcd | ||
tags: | ||
- etcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Deploy master | ||
hosts: masters | ||
become: yes | ||
roles: | ||
- master | ||
tags: | ||
- masters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: Deploy node | ||
hosts: nodes | ||
become: yes | ||
roles: | ||
- node | ||
# serial: 3 | ||
tags: | ||
- nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cluster_name: cluster.local | ||
kube_master_ip: 10.7.0.10 | ||
kube_service_cidr: 10.254.0.0/16 | ||
calico_ippool_cidr: 172.16.0.0/16 | ||
concurrent_node: 3 # deploy node concurrency | ||
|
||
essentials_installed: false # essential packages(docker,nsenter,socat...) installed | ||
net_install: false | ||
all_in_one: false | ||
|
||
public_iface: eth1 # for vagrant change this to eth1 | ||
|
||
# kube-addons | ||
kube_ui: false | ||
cluster_logging: false | ||
cluster_monitoring: false | ||
kube_network_policy: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[etcd] | ||
10.7.0.10 | ||
|
||
[masters] | ||
10.7.0.10 | ||
|
||
[nodes] | ||
10.7.0.11 | ||
10.7.0.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: Prepare binaries on local machine | ||
hosts: localhost | ||
connection: local | ||
become: false | ||
gather_facts: false | ||
roles: | ||
- local | ||
|
||
- name: Prepare binaries on remote machines | ||
hosts: all | ||
become: true | ||
roles: | ||
- remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- { role: common } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
- name: Ensure addons directory exist | ||
file: path={{ item }} state=directory mode=0755 | ||
with_items: | ||
- /etc/kubernetes/addons/dns | ||
- /etc/kubernetes/addons/dashboard | ||
- /etc/kubernetes/addons/logging | ||
- /etc/kubernetes/addons/monitoring | ||
|
||
- name: Install kubedns | ||
template: src="dns/{{ item }}.yaml.j2" dest="/etc/kubernetes/addons/dns/{{ item }}.yaml" mode=0644 | ||
with_items: | ||
- skydns-rc | ||
- skydns-svc | ||
|
||
- name: Install kubernetes dashboard | ||
template: src="dashboard/{{ item }}.yaml.j2" dest="/etc/kubernetes/addons/dashboard/{{ item }}.yaml" mode=0644 | ||
with_items: | ||
- dashboard-controller | ||
- dashboard-service | ||
when: kube_ui | ||
|
||
- name: Install logging addons | ||
template: src="logging/{{ item }}.yaml.j2" dest="/etc/kubernetes/addons/logging/{{ item }}.yaml" mode=0644 | ||
with_items: | ||
- es-rc | ||
- es-svc | ||
- fluentd-ds | ||
- kibana-rc | ||
- kibana-svc | ||
when: cluster_logging | ||
|
||
- name: Install monitoring addons | ||
template: src="monitoring/{{ item }}.yaml.j2" dest="/etc/kubernetes/addons/monitoring/{{ item }}.yaml" mode=0644 | ||
with_items: | ||
- node-exporter-ds | ||
- prometheus-rc | ||
- prometheus-svc | ||
- grafana-rc | ||
- grafana-svc | ||
when: cluster_monitoring |
40 changes: 40 additions & 0 deletions
40
roles/addons/templates/dashboard/dashboard-controller.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This file should be kept in sync with cluster/gce/coreos/kube-manifests/addons/dashboard/dashboard-controller.yaml | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: kubernetes-dashboard | ||
namespace: kube-system | ||
labels: | ||
k8s-app: kubernetes-dashboard | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
selector: | ||
matchLabels: | ||
k8s-app: kubernetes-dashboard | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: kubernetes-dashboard | ||
annotations: | ||
scheduler.alpha.kubernetes.io/critical-pod: '' | ||
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' | ||
spec: | ||
containers: | ||
- name: kubernetes-dashboard | ||
image: gcr.io/google_containers/kubernetes-dashboard-amd64:v{{ kubernetes_dashboard_version }} | ||
resources: | ||
# keep request = limit to keep this container in guaranteed class | ||
limits: | ||
cpu: 100m | ||
memory: 50Mi | ||
requests: | ||
cpu: 100m | ||
memory: 50Mi | ||
ports: | ||
- containerPort: 9090 | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 9090 | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 30 |
15 changes: 15 additions & 0 deletions
15
roles/addons/templates/dashboard/dashboard-service.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file should be kept in sync with cluster/gce/coreos/kube-manifests/addons/dashboard/dashboard-service.yaml | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kubernetes-dashboard | ||
namespace: kube-system | ||
labels: | ||
k8s-app: kubernetes-dashboard | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
selector: | ||
k8s-app: kubernetes-dashboard | ||
ports: | ||
- port: 80 | ||
targetPort: 9090 |
Oops, something went wrong.