mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2025-08-01 13:49:01 +02:00
Move pod network to task file, after master taint
This will allow the selection of the type of pod network add-on to be installed. Default to flannel. Certain pod network plugins spin up pods, requiring that the master be able to schedule them at install time if the master is configured to allow pods to run.
This commit is contained in:
parent
68fc2d8ab3
commit
96089dcc21
@ -21,6 +21,7 @@ kubernetes_allow_pods_on_master: true
|
||||
kubernetes_enable_web_ui: true
|
||||
kubernetes_web_ui_manifest_file: https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
|
||||
|
||||
kubernetes_pod_network_plugin: 'flannel'
|
||||
kubernetes_pod_network_cidr: '10.244.0.0/16'
|
||||
kubernetes_apiserver_advertise_address: ''
|
||||
kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
|
||||
|
@ -29,14 +29,6 @@
|
||||
dest: ~/.kube/config
|
||||
state: link
|
||||
|
||||
- name: Configure Flannel networking.
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- kubectl apply -f {{ kubernetes_flannel_manifest_file_rbac }}
|
||||
- kubectl apply -f {{ kubernetes_flannel_manifest_file }}
|
||||
register: flannel_result
|
||||
changed_when: "'created' in flannel_result.stdout"
|
||||
|
||||
# TODO: Check if taint exists with something like `kubectl describe nodes`
|
||||
# instead of using kubernetes_init_stat.stat.exists check.
|
||||
- name: Allow pods on master node (if configured).
|
||||
@ -45,6 +37,10 @@
|
||||
- kubernetes_allow_pods_on_master
|
||||
- not kubernetes_init_stat.stat.exists
|
||||
|
||||
# Set up pod network.
|
||||
- include_tasks: pod-network.yml
|
||||
when: not kubernetes_init_stat.stat.exists
|
||||
|
||||
- name: Check if Kubernetes Dashboard UI service already exists.
|
||||
shell: kubectl get services --namespace kube-system | grep -q kubernetes-dashboard
|
||||
changed_when: false
|
||||
|
9
tasks/pod-network.yml
Normal file
9
tasks/pod-network.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Configure Flannel networking.
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- kubectl apply -f {{ kubernetes_flannel_manifest_file_rbac }}
|
||||
- kubectl apply -f {{ kubernetes_flannel_manifest_file }}
|
||||
register: flannel_result
|
||||
when: kubernetes_pod_network_plugin == 'flannel'
|
||||
changed_when: "'created' in flannel_result.stdout"
|
Loading…
Reference in New Issue
Block a user