Configure kube-router pod network CNI

This commit is contained in:
Benjamin R. J. Schwedler 2019-01-07 11:49:24 -06:00
parent 96089dcc21
commit 4d0749302f
3 changed files with 25 additions and 0 deletions

View File

@ -51,6 +51,10 @@ Whether to remove the taint that denies pods from being deployed to the Kubernet
Whether to enable the Kubernetes web dashboard UI (only accessible on the master itself, or proxied), and the file containing the web dashboard UI manifest.
kubernetes_pod_network_plugin: 'flannel'
Pod network plugin to use, otherwise called a container network interface (CNI). Supported options are `flannel` and `kube-router`
kubernetes_pod_network_cidr: '10.244.0.0/16'
kubernetes_apiserver_advertise_address: ''
kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
@ -73,6 +77,11 @@ Yum repository options for Kubernetes installation.
Flannel manifest files to apply to the Kubernetes cluster to enable networking. You can copy your own files to your server and apply them instead, if you need to customize the Flannel networking configuration.
kubernetes_kuberouter_manifest_file: https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter-all-features.yaml
kubernetes_kubeproxy_version: '1.10.2'
Kube-Router manifest file to apply to the Kubernetes cluster to enable Kube-Router networking. This is activated by setting `kubernetes_pod_network_plugin: 'kube-router'`
## Dependencies
None.

View File

@ -37,3 +37,7 @@ 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
# Kube-Router config files.
kubernetes_kuberouter_manifest_file: >-
https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter-all-features.yaml
kubernetes_kubeproxy_version: '1.10.2'

View File

@ -7,3 +7,15 @@
register: flannel_result
when: kubernetes_pod_network_plugin == 'flannel'
changed_when: "'created' in flannel_result.stdout"
- name: Configure Kube-router networking.
command: "{{ item }}"
with_items:
- kubectl apply -f {{ kubernetes_kuberouter_manifest_file }}
- kubectl -n kube-system delete ds kube-proxy
- >-
docker run --privileged -v /lib/modules:/lib/modules --net=host
k8s.gcr.io/kube-proxy-amd64:v{{ kubernetes_kubeproxy_version }} kube-proxy --cleanup
register: kuberouter_result
when: kubernetes_pod_network_plugin == 'kube-router'
changed_when: "'created' in kuberouter_result.stdout"