From 8548638875d16bb5a2f352438ac17ce8429eac59 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 10 May 2018 09:37:53 -0500 Subject: [PATCH] Add more variables and docs. --- README.md | 24 ++++++++++++++++++------ defaults/main.yml | 3 +++ tasks/main.yml | 6 +++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d6af6b3..044b82e 100644 --- a/README.md +++ b/README.md @@ -20,29 +20,35 @@ Available variables are listed below, along with default values (see `defaults/m - name: kubernetes-cni 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: "" -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 -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 -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_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}" kubernetes_apt_ignore_key_error: False -TODO. +Apt repository options for Kubernetes installation. kubernetes_yum_arch: x86_64 -TODO. +Yum repository options for Kubernetes installation. ## Dependencies @@ -50,8 +56,14 @@ None. ## Example Playbook +For a single node (master) Kubernetes cluster: + ```yaml - hosts: all + + vars: + kubernetes_allow_pods_on_master: True + roles: - geerlingguy.docker - geerlingguy.kubernetes diff --git a/defaults/main.yml b/defaults/main.yml index 9c3d1da..c9263f3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,9 @@ kubernetes_kubelet_extra_args: "" kubernetes_allow_pods_on_master: 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 # Note that xenial repo is used for all Debian derivatives at this time. diff --git a/tasks/main.yml b/tasks/main.yml index f3f18cb..fdd555d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -38,10 +38,10 @@ - name: Initialize the Kubernetes master with kubeadm init. command: > kubeadm init - --pod-network-cidr=10.0.1.0/16 + --pod-network-cidr={{ kubernetes_pod_network_cidr }} --apiserver-advertise-address={{ ansible_default_ipv4.address }} - --kubernetes-version stable-1.10 - --ignore-preflight-errors=all + --kubernetes-version {{ kubernetes_version }} + --ignore-preflight-errors={{ kubernetes_ignore_preflight_errors }} register: kubeadmin_init failed_when: False when: kubernetes_init_stat.stat.exists == False