Skip to content
Snippets Groups Projects
Commit 60122301 authored by ant31's avatar ant31
Browse files

Merge branch 'ha_master' of https://github.com/ansibl8s/setup-kubernetes into ha

parents 693230ac 61bb6468
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ kube-master ...@@ -48,7 +48,7 @@ kube-master
Run the playbook Run the playbook
``` ```
ansible-playbook -i environments/production/inventory cluster.yml -u root ansible-playbook -i environments/test/inventory cluster.yml -u root
``` ```
You can jump directly to "*Available apps, installation procedure*" You can jump directly to "*Available apps, installation procedure*"
...@@ -59,7 +59,7 @@ Ansible ...@@ -59,7 +59,7 @@ Ansible
### Download binaries ### Download binaries
A role allows to download required binaries. They will be stored in a directory defined by the variable A role allows to download required binaries. They will be stored in a directory defined by the variable
**'local_release_dir'** (by default /tmp). **'local_release_dir'** (by default /tmp).
Please ensure that you have enough disk space there (about **1G**). Please ensure that you have enough disk space there (about **300M**).
**Note**: Whenever you'll need to change the version of a software, you'll have to erase the content of this directory. **Note**: Whenever you'll need to change the version of a software, you'll have to erase the content of this directory.
...@@ -106,14 +106,6 @@ In node-mesh mode the nodes peers with all the nodes in order to exchange routes ...@@ -106,14 +106,6 @@ In node-mesh mode the nodes peers with all the nodes in order to exchange routes
[k8s-cluster:children] [k8s-cluster:children]
kube-node kube-node
kube-master 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 ### Playbook
...@@ -124,13 +116,9 @@ loadbalancer_address="10.99.0.44" ...@@ -124,13 +116,9 @@ loadbalancer_address="10.99.0.44"
roles: roles:
- { role: download, tags: download } - { role: download, tags: download }
# etcd must be running on master(s) before going on
- hosts: etcd
roles:
- { role: etcd, tags: etcd }
- hosts: k8s-cluster - hosts: k8s-cluster
roles: roles:
- { role: etcd, tags: etcd }
- { role: docker, tags: docker } - { role: docker, tags: docker }
- { role: dnsmasq, tags: dnsmasq } - { role: dnsmasq, tags: dnsmasq }
- { role: network_plugin, tags: ['calico', 'flannel', 'network'] } - { role: network_plugin, tags: ['calico', 'flannel', 'network'] }
...@@ -161,6 +149,9 @@ the server address has to be present on both groups 'kube-master' and 'kube-node ...@@ -161,6 +149,9 @@ the server address has to be present on both groups 'kube-master' and 'kube-node
* Almost all kubernetes components are running into pods except *kubelet*. These pods are managed by kubelet which ensure they're always running * Almost all kubernetes components are running into pods except *kubelet*. These pods are managed by kubelet which ensure they're always running
* One etcd cluster member per node will be configured. For safety reasons, you should have at least two master nodes. * One etcd cluster member per node will be configured. For safety reasons, you should have at least two master nodes.
* Kube-proxy doesn't support multiple apiservers on startup ([#18174]('https://github.com/kubernetes/kubernetes/issues/18174')). An external loadbalancer needs to be configured.
In order to do so, some variables have to be used '**loadbalancer_apiserver**' and '**apiserver_loadbalancer_domain_name**'
### Network Overlay ### Network Overlay
......
...@@ -73,8 +73,8 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address ...@@ -73,8 +73,8 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address
# For multi masters architecture: # For multi masters architecture:
# kube-proxy doesn't support multiple apiservers for the time being so you'll need to configure your own loadbalancer # kube-proxy doesn't support multiple apiservers for the time being so you'll need to configure your own loadbalancer
# This domain name will be inserted into the /etc/hosts file of all servers # This domain name will be inserted into the /etc/hosts file of all servers
# configurationexample with haproxy : # configuration example with haproxy :
# lissten kubernetes-apiserver-https # listen kubernetes-apiserver-https
# bind 10.99.0.21:8383 # bind 10.99.0.21:8383
# option ssl-hello-chk # option ssl-hello-chk
# mode tcp # mode tcp
...@@ -83,4 +83,4 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address ...@@ -83,4 +83,4 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(253)|ipaddr('address
# server master1 10.99.0.26:443 # server master1 10.99.0.26:443
# server master2 10.99.0.27:443 # server master2 10.99.0.27:443
# balance roundrobin # balance roundrobin
apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local" # apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
--- #---
peers: #peers:
-router_id: "10.99.0.34" # -router_id: "10.99.0.34"
as: "65xxx" # as: "65xxx"
- router_id: "10.99.0.35" # - router_id: "10.99.0.35"
as: "65xxx" # as: "65xxx"
#
loadbalancer_apiserver: #loadbalancer_apiserver:
address: "10.99.0.44" # address: "10.99.0.44"
port: "8383" # port: "8383"
--- #---
peers: #peers:
-router_id: "10.99.0.2" # -router_id: "10.99.0.2"
as: "65xxx" # as: "65xxx"
- router_id: "10.99.0.3" # - router_id: "10.99.0.3"
as: "65xxx" # as: "65xxx"
#
loadbalancer_apiserver: #loadbalancer_apiserver:
address: "10.99.0.21" # address: "10.99.0.21"
port: "8383" # port: "8383"
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
regexp: ".*{{ apiserver_loadbalancer_domain_name }}$" regexp: ".*{{ apiserver_loadbalancer_domain_name }}$"
line: "{{ loadbalancer_apiserver.address }} lb-apiserver.kubernetes.local" line: "{{ loadbalancer_apiserver.address }} lb-apiserver.kubernetes.local"
state: present state: present
when: loadbalancer_apiserver is defined when: loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined
- name: clean hosts file - name: clean hosts file
lineinfile: lineinfile:
......
...@@ -15,7 +15,7 @@ spec: ...@@ -15,7 +15,7 @@ spec:
{% if inventory_hostname in groups['kube-master'] %} {% if inventory_hostname in groups['kube-master'] %}
- --master=http://127.0.0.1:{{kube_apiserver_insecure_port}} - --master=http://127.0.0.1:{{kube_apiserver_insecure_port}}
{% else %} {% else %}
{% if loadbalancer_apiserver.address is defined | default('') %} {% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
- --master=https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port }} - --master=https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port }}
{% else %} {% else %}
- --master=https://{{ groups['kube-master'][0] }}:{{ kube_apiserver_port }} - --master=https://{{ groups['kube-master'][0] }}:{{ kube_apiserver_port }}
......
...@@ -10,7 +10,9 @@ subjectAltName = @alt_names ...@@ -10,7 +10,9 @@ subjectAltName = @alt_names
DNS.1 = kubernetes DNS.1 = kubernetes
DNS.2 = kubernetes.default DNS.2 = kubernetes.default
DNS.3 = kubernetes.default.svc.{{ dns_domain }} DNS.3 = kubernetes.default.svc.{{ dns_domain }}
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
DNS.4 = {{ apiserver_loadbalancer_domain_name }} DNS.4 = {{ apiserver_loadbalancer_domain_name }}
{% endif %}
{% for host in groups['kube-master'] %} {% for host in groups['kube-master'] %}
IP.{{ loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }} IP.{{ loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
{% endfor %} {% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment