diff --git a/README.md b/README.md index ee4af9d..9b15997 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,11 @@ Whether to enable the Kubernetes web dashboard UI (only accessible on the master # Calico CNI. # cni: 'calico' # cidr: '192.168.0.0/16' - -This role currently supports `flannel` (default) or `calico` for cluster pod networking. Choose one or the other for your cluster; converting between the two is not done automatically and could result in broken networking, and should be done outside of this role. + # Weave CNI. + # cni: 'weave' + # cidr: '192.168.0.0/16' + +This role currently supports `flannel` (default), `calico` or `weave` for cluster pod networking. Choose one or the other for your cluster; converting between the three is not done automatically and could result in broken networking, and should be done outside of this role. kubernetes_apiserver_advertise_address: '' kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}' diff --git a/tasks/master-setup.yml b/tasks/master-setup.yml index 935e832..ce1d7c5 100644 --- a/tasks/master-setup.yml +++ b/tasks/master-setup.yml @@ -44,6 +44,19 @@ changed_when: "'created' in calico_result.stdout" when: kubernetes_pod_network.cni == 'calico' +- name: "Get K8s version" + shell: kubectl version | base64 | tr -d '\n' + register: k8_version + when: kubernetes_pod_network.cni == 'weave' + +- name: Configure Weave networking. + command: "{{ item }}" + with_items: + - "kubectl apply -f https://cloud.weave.works/k8s/net?k8s-version={{ k8_version.stdout_lines[0] }}" + register: weave_result + changed_when: "'created' in weave_result.stdout" + when: kubernetes_pod_network.cni == 'weave' + # 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).