This commit is contained in:
James McCallum 2018-06-08 14:42:45 +10:00
parent c287258b04
commit c818a64367
4 changed files with 23 additions and 6 deletions

View File

@ -17,8 +17,8 @@ kubernetes_allow_pods_on_master: True
kubernetes_enable_web_ui: True
kuberenetes_debug: False
kubernetes_pod_network_cidr: '10.0.1.0/16'
kubernetes_apiserver_advertise_address: ''
kubernetes_pod_network_cidr: '10.244.0.0/16'
kubernetes_apiserver_advertise_address: '0.0.0.0'
kubernetes_version: 'stable-1.10'
kubernetes_ignore_preflight_errors: 'all'

View File

@ -35,6 +35,12 @@
path: /etc/kubernetes/admin.conf
register: kubernetes_init_stat
- name: configure docker cgroup driver
shell: sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
- name: restart docker services
shell: systemctl daemon-reload && service kubelet restart
# Set up master.
- include_tasks: master-setup.yml
when: kubernetes_role == 'master'
@ -43,8 +49,8 @@
- name: Get the kubeadm join command from the Kubernetes master.
shell: kubeadm token create --print-join-command
changed_when: False
when: kubernetes_role == 'master'
run_once: True
run_once: true
delegate_to: "{{ groups['master'][0] }}"
register: kubernetes_join_command
- include_tasks: node-setup.yml

View File

@ -44,7 +44,7 @@
- kubernetes_init_stat.stat.exists == False
- name: Check if Kubernetes Dashboard UI service already exists.
shell: kubectl get services --namespace kube-system | grep -q kubernetes-dashboard
shell: kubectl get pods -n kube-system | grep kubernetes-dashboard
changed_when: False
failed_when: False
register: kubernetes_dashboard_service
@ -54,4 +54,11 @@
command: "kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml"
when:
- kubernetes_enable_web_ui
- kubernetes_dashboard_service is failed
- kubernetes_dashboard_service.stdout.find("kubernetes-dashboard") == -1
- name: Wait for cluster to be ready
shell: kubectl get nodes
register: cluster
until: cluster.stdout.find(" Ready") != -1
retries: 30
delay: 10

View File

@ -1,4 +1,8 @@
---
- name: print join command
debug:
msg: "{{ kubernetes_join_command }}"
- name: Join node to Kubernetes master
shell: >
{{ kubernetes_join_command.stdout }}