Add more variables and docs.

This commit is contained in:
Jeff Geerling 2018-05-10 09:37:53 -05:00
parent d9f100d313
commit 8548638875
3 changed files with 24 additions and 9 deletions

View File

@ -20,29 +20,35 @@ Available variables are listed below, along with default values (see `defaults/m
- name: kubernetes-cni - name: kubernetes-cni
state: present state: present
TODO. Kubernetes packages to be installed on the server. You can either provide a list of package names, or set `name` and `state` to have more control over whether the package is `present`, `absent`, `latest`, etc.
kubernetes_kubelet_extra_args: "" kubernetes_kubelet_extra_args: ""
TODO. Example: `"--fail-swap-on=false --cgroup-driver=systemd"`. Extra args to pass to `kubelet` during startup. E.g. to allow `kubelet` to start up even if there is swap is enabled on your server, set this to: `"--fail-swap-on=false"`.
kubernetes_allow_pods_on_master: True kubernetes_allow_pods_on_master: True
TODO. Whether to remove the taint that denies pods from being deployed to the Kubernetes master. If you have a single-node cluster, this should definitely be `True`. Otherwise, set to `False` if you want a dedicated Kubernetes master which doesn't run any other pods.
kubernetes_enable_web_ui: False kubernetes_enable_web_ui: False
TODO. Whether to enable the Kubernetes web dashboard UI (only accessible on the master itself, or proxied).
kubernetes_pod_network_cidr: '10.0.1.0/16'
kubernetes_version: 'stable-1.10'
kubernetes_ignore_preflight_errors: 'all'
Options passed to `kubeadm init` when initializing the Kubernetes master.
kubernetes_apt_release_channel: main kubernetes_apt_release_channel: main
kubernetes_apt_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}" kubernetes_apt_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}"
kubernetes_apt_ignore_key_error: False kubernetes_apt_ignore_key_error: False
TODO. Apt repository options for Kubernetes installation.
kubernetes_yum_arch: x86_64 kubernetes_yum_arch: x86_64
TODO. Yum repository options for Kubernetes installation.
## Dependencies ## Dependencies
@ -50,8 +56,14 @@ None.
## Example Playbook ## Example Playbook
For a single node (master) Kubernetes cluster:
```yaml ```yaml
- hosts: all - hosts: all
vars:
kubernetes_allow_pods_on_master: True
roles: roles:
- geerlingguy.docker - geerlingguy.docker
- geerlingguy.kubernetes - geerlingguy.kubernetes

View File

@ -13,6 +13,9 @@ kubernetes_kubelet_extra_args: ""
kubernetes_allow_pods_on_master: True kubernetes_allow_pods_on_master: True
kubernetes_enable_web_ui: True kubernetes_enable_web_ui: True
kubernetes_pod_network_cidr: '10.0.1.0/16'
kubernetes_version: 'stable-1.10'
kubernetes_ignore_preflight_errors: 'all'
kubernetes_apt_release_channel: main kubernetes_apt_release_channel: main
# Note that xenial repo is used for all Debian derivatives at this time. # Note that xenial repo is used for all Debian derivatives at this time.

View File

@ -38,10 +38,10 @@
- name: Initialize the Kubernetes master with kubeadm init. - name: Initialize the Kubernetes master with kubeadm init.
command: > command: >
kubeadm init kubeadm init
--pod-network-cidr=10.0.1.0/16 --pod-network-cidr={{ kubernetes_pod_network_cidr }}
--apiserver-advertise-address={{ ansible_default_ipv4.address }} --apiserver-advertise-address={{ ansible_default_ipv4.address }}
--kubernetes-version stable-1.10 --kubernetes-version {{ kubernetes_version }}
--ignore-preflight-errors=all --ignore-preflight-errors={{ kubernetes_ignore_preflight_errors }}
register: kubeadmin_init register: kubeadmin_init
failed_when: False failed_when: False
when: kubernetes_init_stat.stat.exists == False when: kubernetes_init_stat.stat.exists == False