Skip to content
Snippets Groups Projects
Commit fca384e2 authored by Smana's avatar Smana
Browse files

first version of CoreOS on GCE

 Please enter the commit message for your changes. Lines starting
parent ec64eda2
No related branches found
No related tags found
No related merge requests found
Showing
with 19101 additions and 17503 deletions
...@@ -13,6 +13,7 @@ Linux distributions tested: ...@@ -13,6 +13,7 @@ Linux distributions tested:
* **Ubuntu** 14.10, 15.04, 15.10 * **Ubuntu** 14.10, 15.04, 15.10
* **Fedora** 23 * **Fedora** 23
* **CentOS/RHEL** 7 * **CentOS/RHEL** 7
* **CoreOS**
### Requirements ### Requirements
* The target servers must have **access to the Internet** in order to pull docker imaqes. * The target servers must have **access to the Internet** in order to pull docker imaqes.
...@@ -68,6 +69,18 @@ You can jump directly to "*Available apps, installation procedure*" ...@@ -68,6 +69,18 @@ You can jump directly to "*Available apps, installation procedure*"
Ansible Ansible
------------------------- -------------------------
### Coreos bootstrap
Before running the cluster playbook you must satisfy the following requirements:
* On each CoreOS nodes a writable directory **/opt/bin** (~400M disk space)
* Uncomment the variable **ansible_python_interpreter** in the file `inventory/group_vars/all.yml`
* run the Python bootstrap playbook
```
ansible-playbook -u smana -e ansible_ssh_user=smana -b --become-user=root -i inventory/inventory.cfg coreos-bootstrap.yml
```
Then you can proceed to cluster deployment
### Variables ### Variables
The main variables to change are located in the directory ```inventory/group_vars/all.yml```. The main variables to change are located in the directory ```inventory/group_vars/all.yml```.
...@@ -179,7 +192,6 @@ For the master nodes you'll have to see the docker logs for the apiserver ...@@ -179,7 +192,6 @@ For the master nodes you'll have to see the docker logs for the apiserver
docker logs [apiserver docker id] docker logs [apiserver docker id]
``` ```
### Available apps, installation procedure ### Available apps, installation procedure
There are two ways of installing new apps There are two ways of installing new apps
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- { role: download, tags: download } - { role: download, tags: download }
- { role: kubernetes/preinstall, tags: preinstall } - { role: kubernetes/preinstall, tags: preinstall }
- { role: etcd, tags: etcd } - { role: etcd, tags: etcd }
- { role: docker, tags: docker } - { role: docker, tags: docker, when: ansible_os_family != "CoreOS" }
- { role: kubernetes/node, tags: node } - { role: kubernetes/node, tags: node }
- { role: network_plugin, tags: network } - { role: network_plugin, tags: network }
- { role: dnsmasq, tags: dnsmasq } - { role: dnsmasq, tags: dnsmasq }
......
---
- hosts: k8s-cluster
gather_facts: False
roles:
- coreos-bootstrap
...@@ -5,6 +5,10 @@ bin_dir: /usr/local/bin ...@@ -5,6 +5,10 @@ bin_dir: /usr/local/bin
# Note: ensure that you've enough disk space (about 1G) # Note: ensure that you've enough disk space (about 1G)
local_release_dir: "/tmp/releases" local_release_dir: "/tmp/releases"
# Uncomment this line for CoreOS only.
# Directory where python binary is installed
# ansible_python_interpreter: "/opt/bin/python"
# This is the group that the cert creation scripts chgrp the # This is the group that the cert creation scripts chgrp the
# cert files to. Not really changable... # cert files to. Not really changable...
kube_cert_group: kube-cert kube_cert_group: kube-cert
......
---
- name: gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
- "{{ ansible_distribution|lower }}.yml"
- "{{ ansible_os_family|lower }}.yml"
- defaults.yml
paths:
- ../vars
skip: true
- name: User | Create User Group - name: User | Create User Group
group: name={{item.group|default(item.name)}} system={{item.system|default(omit)}} group: name={{item.group|default(item.name)}} system={{item.system|default(omit)}}
with_items: addusers with_items: addusers
......
---
addusers:
- name: kube
comment: "Kubernetes user"
shell: /sbin/nologin
system: yes
group: "{{ kube_cert_group }}"
createhome: no
---
addusers:
- name: etcd
comment: "Etcd user"
createhome: yes
home: "/var/lib/etcd"
system: yes
shell: /bin/nologin
- name: kube
comment: "Kubernetes user"
shell: /sbin/nologin
system: yes
group: "{{ kube_cert_group }}"
createhome: no
---
pypy_version: 2.4.0
pip_python_modules:
- httplib2
#/bin/bash #/bin/bash
set -e set -e
BINDIR="/usr/local/bin" BINDIR="/opt/bin"
cd $BINDIR cd $BINDIR
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
#!/bin/bash #!/bin/bash
BINDIR="/usr/local/bin" BINDIR="/opt/bin"
LD_LIBRARY_PATH=$BINDIR/pypy/lib:$LD_LIBRARY_PATH $BINDIR/pypy/bin/$(basename $0) $@ LD_LIBRARY_PATH=$BINDIR/pypy/lib:$LD_LIBRARY_PATH $BINDIR/pypy/bin/$(basename $0) $@
--- ---
- name: Python | Check if bootstrap is needed - name: Bootstrap | Check if bootstrap is needed
raw: stat {{ bin_dir}}/.bootstrapped raw: stat /opt/bin/.bootstrapped
register: need_bootstrap register: need_bootstrap
ignore_errors: True ignore_errors: True
- name: Python | Run bootstrap.sh - name: Bootstrap | Run bootstrap.sh
script: bootstrap.sh script: bootstrap.sh
when: need_bootstrap | failed when: need_bootstrap | failed
- set_fact: - set_fact:
ansible_python_interpreter: "{{ bin_dir }}/python" ansible_python_interpreter: "/opt/bin/python"
- name: Python | Check if we need to install pip - name: Bootstrap | Check if we need to install pip
shell: "{{ansible_python_interpreter}} -m pip --version" shell: "{{ansible_python_interpreter}} -m pip --version"
register: need_pip register: need_pip
ignore_errors: True ignore_errors: True
changed_when: false changed_when: false
when: need_bootstrap | failed when: need_bootstrap | failed
- name: Python | Copy get-pip.py - name: Bootstrap | Copy get-pip.py
copy: src=get-pip.py dest=~/get-pip.py copy: src=get-pip.py dest=~/get-pip.py
when: need_pip | failed when: need_pip | failed
- name: Python | Install pip - name: Bootstrap | Install pip
shell: "{{ansible_python_interpreter}} ~/get-pip.py" shell: "{{ansible_python_interpreter}} ~/get-pip.py"
when: need_pip | failed when: need_pip | failed
- name: Python | Remove get-pip.py - name: Bootstrap | Remove get-pip.py
file: path=~/get-pip.py state=absent file: path=~/get-pip.py state=absent
when: need_pip | failed when: need_pip | failed
- name: Python | Install pip launcher - name: Bootstrap | Install pip launcher
copy: src=runner dest={{ bin_dir }}/pip mode=0755 copy: src=runner dest=/opt/bin/pip mode=0755
when: need_pip | failed when: need_pip | failed
- name: Install required python modules - name: Install required python modules
pip: pip:
name: "{{ item }}" name: "{{ item }}"
with_items: pip_python_modules with_items: pip_python_modules
#!/bin/bash
LD_LIBRARY_PATH={{ pypy_install_path }}/lib:$LD_LIBRARY_PATH exec {{ pypy_install_path }}/bin/{{ item.src }} "$@"
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
- defaults.yml - defaults.yml
paths: paths:
- ../vars - ../vars
skip: true
- name: check for minimum kernel version - name: check for minimum kernel version
fail: fail:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- name: Configure | Copy etcd.service systemd file - name: Configure | Copy etcd.service systemd file
template: template:
src: etcd.service.j2 src: etcd.service.j2
dest: /lib/systemd/system/etcd.service dest: /etc/systemd/system/etcd.service
backup: yes backup: yes
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"
notify: restart etcd notify: restart etcd
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
copy: copy:
src: kubectl_bash_completion.sh src: kubectl_bash_completion.sh
dest: /etc/bash_completion.d/kubectl.sh dest: /etc/bash_completion.d/kubectl.sh
when: ansible_os_family in ["Debian","RedHat"]
- name: Copy kube-apiserver binary - name: Copy kube-apiserver binary
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kube-apiserver" "{{ bin_dir }}/kube-apiserver" command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kube-apiserver" "{{ bin_dir }}/kube-apiserver"
......
...@@ -18,12 +18,3 @@ ...@@ -18,12 +18,3 @@
command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kubelet" "{{ bin_dir }}/kubelet" command: rsync -piu "{{ local_release_dir }}/kubernetes/bin/kubelet" "{{ bin_dir }}/kubelet"
register: kubelet_copy register: kubelet_copy
changed_when: false changed_when: false
- name: install | Calico-plugin | Directory
file: path=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/ state=directory
when: kube_network_plugin == "calico"
- name: install | Calico-plugin | Binary
command: rsync -piu "{{ local_release_dir }}/calico/bin/calico" "/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico"
when: kube_network_plugin == "calico"
changed_when: false
...@@ -8,5 +8,3 @@ common_required_pkgs: ...@@ -8,5 +8,3 @@ common_required_pkgs:
- rsync - rsync
- bash-completion - bash-completion
pypy_version: 2.4.0
python_pypy_url: "https://bitbucket.org/pypy/pypy/downloads/pypy-{{ pypy_version }}.tar.bz2"
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment