Kubespray is a project under the Kubernetes incubator. Its mission is to provide a production-ready Kubernetes deployment solution. The project is based on Ansible Playbook to define system and Kubernetes cluster deployment tasks, with the following characteristics:
It can be deployed on AWS, GCE, Azure, OpenStack, and bare metal.
It allows for the deployment of highly available Kubernetes clusters.
It is composable, allowing users to choose Network Plugin (flannel, calico, canal, weave) for deployment.
It supports various Linux distributions (CoreOS, Debian Jessie, Ubuntu 16.04, CentOS/RHEL7).
This article will explain how to deploy Kubernetes to bare metal nodes using Kubespray. The versions will be as follows:
Kubernetes v1.7.3
Etcd v3.2.4
Flannel v0.8.0
Docker v17.04.0-ce
Node Information
The operating system for the installation test environment will be Ubuntu 16.04 Server and the other details are as follows:
IP Address
Role
CPU
Memory
Here, the master is the primary control node, and the node is the work node.
Preparatory Information
All nodes' networks can communicate with each other.
The deployment node (here, master1) can log in to other nodes without needing SSH passwords.
All nodes possess Sudoer permissions and don't require password input.
All nodes need to have Python installed.
All nodes need to set /etc/hosts to resolve all hosts.
Modify all nodes' /etc/resolv.conf
$echo"nameserver 8.8.8.8"|sudotee/etc/resolv.conf
The deployment node (here, master1) installs Ansible >= 2.3.0.
The process for installing Ansible on Ubuntu 16.04 is as follows:
Installing Kubespray and Preparing Deployment Information
First, install kubespray-cli through pypi. Although the official sources say they have switched to a Go language version of the tool, it hasn't been updated, so we'll use the pypi version for now:
$sudopipinstall-Ukubespray
After installation, add a configuration file ~/.kubespray.yml and include the following content: