mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2024-11-18 19:10:39 +01:00
commit
8d4e1b4dfc
@ -22,7 +22,12 @@ kubernetes_allow_pods_on_master: true
|
||||
kubernetes_enable_web_ui: true
|
||||
kubernetes_web_ui_manifest_file: https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
|
||||
|
||||
kubernetes_pod_network_cidr: '10.244.0.0/16'
|
||||
kubernetes_cni: 'calico'
|
||||
kubernetes_pod_network:
|
||||
- name: 'flannel'
|
||||
cidr: '10.244.0.0/16'
|
||||
- name: 'calico'
|
||||
cidr: '192.168.0.0/16'
|
||||
kubernetes_apiserver_advertise_address: ''
|
||||
kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
|
||||
kubernetes_ignore_preflight_errors: 'all'
|
||||
@ -37,3 +42,6 @@ kubernetes_yum_arch: x86_64
|
||||
# Flannel config files.
|
||||
kubernetes_flannel_manifest_file_rbac: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
|
||||
kubernetes_flannel_manifest_file: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
|
||||
|
||||
# Calico config files
|
||||
kubernetes_calico_manifest_file: https://docs.projectcalico.org/v3.7/manifests/calico.yaml
|
||||
|
@ -2,15 +2,15 @@
|
||||
- name: Initialize Kubernetes master with kubeadm init.
|
||||
command: >
|
||||
kubeadm init
|
||||
--pod-network-cidr={{ kubernetes_pod_network_cidr }}
|
||||
--pod-network-cidr={{ item.cidr }}
|
||||
--apiserver-advertise-address={{ kubernetes_apiserver_advertise_address | default(ansible_default_ipv4.address, true) }}
|
||||
--kubernetes-version {{ kubernetes_version_kubeadm }}
|
||||
--ignore-preflight-errors={{ kubernetes_ignore_preflight_errors }}
|
||||
{{ kubernetes_kubeadm_init_extra_opts }}
|
||||
|
||||
with_items: "{{ kubernetes_pod_network }}"
|
||||
register: kubeadmin_init
|
||||
failed_when: false
|
||||
when: not kubernetes_init_stat.stat.exists
|
||||
when: not kubernetes_init_stat.stat.exists and item.name == kubernetes_cni
|
||||
|
||||
- name: Print the init output to screen.
|
||||
debug:
|
||||
@ -36,6 +36,15 @@
|
||||
- kubectl apply -f {{ kubernetes_flannel_manifest_file }}
|
||||
register: flannel_result
|
||||
changed_when: "'created' in flannel_result.stdout"
|
||||
when: kubernetes_cni == 'flannel'
|
||||
|
||||
- name: Configure Calico networking.
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- kubectl apply -f {{ kubernetes_calico_manifest_file }}
|
||||
register: calico_result
|
||||
changed_when: "'created' in calico_result.stdout"
|
||||
when: kubernetes_cni == 'calico'
|
||||
|
||||
# TODO: Check if taint exists with something like `kubectl describe nodes`
|
||||
# instead of using kubernetes_init_stat.stat.exists check.
|
||||
|
Loading…
Reference in New Issue
Block a user