Merge pull request #381 from kubespray/fixetcdstandalone

Fix etcd standalone deployment
pull/386/head
Antoine Legrand 2016-07-26 16:04:26 -07:00 committed by GitHub
commit 9fb391fed5
7 changed files with 39 additions and 24 deletions

View File

@ -1,9 +1,15 @@
--- ---
- hosts: k8s-cluster - hosts: etcd
roles: roles:
- { 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 }
- hosts: k8s-cluster
roles:
- { role: kubernetes/preinstall, tags: preinstall }
- { role: docker, tags: docker }
- { role: etcd, tags: etcd }
- { role: kubernetes/node, tags: node } - { role: kubernetes/node, tags: node }
- { role: network_plugin, tags: network } - { role: network_plugin, tags: network }

View File

@ -18,7 +18,7 @@
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"
- name: wait for etcd up - name: wait for etcd up
uri: url=http://localhost:2379/health uri: url="http://{% if is_etcd_master %}{{ etcd_address }}{% else %}127.0.0.1{% endif %}:2379/health"
register: result register: result
until: result.status == 200 until: result.status == 200
retries: 10 retries: 10

View File

@ -8,3 +8,4 @@ dependencies:
when: etcd_deployment_type == "host" when: etcd_deployment_type == "host"
- role: docker - role: docker
when: (ansible_os_family != "CoreOS" and etcd_deployment_type == "docker") when: (ansible_os_family != "CoreOS" and etcd_deployment_type == "docker")
- role: "kubernetes/preinstall"

View File

@ -3,7 +3,11 @@ ETCD_ADVERTISE_CLIENT_URLS={{ etcd_client_url }}
ETCD_INITIAL_ADVERTISE_PEER_URLS={{ etcd_peer_url }} ETCD_INITIAL_ADVERTISE_PEER_URLS={{ etcd_peer_url }}
ETCD_INITIAL_CLUSTER_STATE={% if etcd_cluster_is_healthy.rc != 0 | bool %}new{% else %}existing{% endif %} ETCD_INITIAL_CLUSTER_STATE={% if etcd_cluster_is_healthy.rc != 0 | bool %}new{% else %}existing{% endif %}
{% if not is_etcd_proxy %}
ETCD_LISTEN_CLIENT_URLS=http://{{ etcd_address }}:2379,http://127.0.0.1:2379
{% else %}
ETCD_LISTEN_CLIENT_URLS=http://{{ etcd_address }}:2379 ETCD_LISTEN_CLIENT_URLS=http://{{ etcd_address }}:2379
{% endif %}
ETCD_ELECTION_TIMEOUT=10000 ETCD_ELECTION_TIMEOUT=10000
ETCD_INITIAL_CLUSTER_TOKEN=k8s_etcd ETCD_INITIAL_CLUSTER_TOKEN=k8s_etcd
ETCD_LISTEN_PEER_URLS=http://{{ etcd_address }}:2380 ETCD_LISTEN_PEER_URLS=http://{{ etcd_address }}:2380

View File

@ -1,16 +1,3 @@
# This directory is where all the additional scripts go
# that Kubernetes normally puts in /srv/kubernetes.
# This puts them in a sane location
kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
# This directory is where all the additional config stuff goes
# the kubernetes normally puts in /srv/kubernets.
# This puts them in a sane location.
# Editting this value will almost surely break something. Don't
# change it. Things like the systemd scripts are hard coded to
# look in here. Don't do it.
kube_config_dir: /etc/kubernetes
# This is where all the cert scripts and certs will be located # This is where all the cert scripts and certs will be located
kube_cert_dir: "{{ kube_config_dir }}/ssl" kube_cert_dir: "{{ kube_config_dir }}/ssl"
@ -20,13 +7,6 @@ kube_token_dir: "{{ kube_config_dir }}/tokens"
# This is where to save basic auth file # This is where to save basic auth file
kube_users_dir: "{{ kube_config_dir }}/users" kube_users_dir: "{{ kube_config_dir }}/users"
# This is where you can drop yaml/json files and the kubelet will run those
# pods on startup
kube_manifest_dir: "{{ kube_config_dir }}/manifests"
# Logging directory (sysvinit systems)
kube_log_dir: "/var/log/kubernetes"
dns_domain: "{{ cluster_name }}" dns_domain: "{{ cluster_name }}"
# resolv.conf to base dns config # resolv.conf to base dns config

View File

@ -1,6 +1,27 @@
--- ---
run_gitinfos: false run_gitinfos: false
# This directory is where all the additional scripts go
# that Kubernetes normally puts in /srv/kubernetes.
# This puts them in a sane location
kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
# This directory is where all the additional config stuff goes
# the kubernetes normally puts in /srv/kubernets.
# This puts them in a sane location.
# Editting this value will almost surely break something. Don't
# change it. Things like the systemd scripts are hard coded to
# look in here. Don't do it.
kube_config_dir: /etc/kubernetes
# Logging directory (sysvinit systems)
kube_log_dir: "/var/log/kubernetes"
# This is where you can drop yaml/json files and the kubelet will run those
# pods on startup
kube_manifest_dir: "{{ kube_config_dir }}/manifests"
common_required_pkgs: common_required_pkgs:
- python-httplib2 - python-httplib2
- openssl - openssl

View File

@ -28,25 +28,28 @@
path: "{{ kube_config_dir }}" path: "{{ kube_config_dir }}"
state: directory state: directory
owner: kube owner: kube
when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
- name: Create kubernetes script directory - name: Create kubernetes script directory
file: file:
path: "{{ kube_script_dir }}" path: "{{ kube_script_dir }}"
state: directory state: directory
owner: kube owner: kube
when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
- name: Create kubernetes manifests directory - name: Create kubernetes manifests directory
file: file:
path: "{{ kube_manifest_dir }}" path: "{{ kube_manifest_dir }}"
state: directory state: directory
owner: kube owner: kube
when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
- name: Create kubernetes logs directory - name: Create kubernetes logs directory
file: file:
path: "{{ kube_log_dir }}" path: "{{ kube_log_dir }}"
state: directory state: directory
owner: kube owner: kube
when: ansible_service_mgr in ["sysvinit","upstart"] when: ansible_service_mgr in ["sysvinit","upstart"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
- name: check cloud_provider value - name: check cloud_provider value
fail: fail:
@ -64,7 +67,7 @@
with_items: with_items:
- "/etc/cni/net.d" - "/etc/cni/net.d"
- "/opt/cni/bin" - "/opt/cni/bin"
when: kube_network_plugin in ["calico", "weave"] when: kube_network_plugin in ["calico", "weave"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
- name: Update package management cache (YUM) - name: Update package management cache (YUM)
yum: update_cache=yes name='*' yum: update_cache=yes name='*'