文档章节

部署生产级的 Kubernetes 集群,使用kubespray

openthings
 openthings
发布于 2018/09/21 22:45
字数 989
阅读 420
收藏 0

Kubernetes Logo

部署生产级的 Kubernetes 集群,使用kubespray

欢迎加入 kubernetes slack, channel #kubespray. 获得邀请从这里 here

  • 可以部署到 AWS, GCE, Azure, OpenStack, vSphere, Oracle Cloud Infrastructure (Experimental), 或 Baremetal
  • Highly available cluster
  • Composable (Choice of the network plugin for instance)
  • Supports most popular Linux distributions
  • Continuous integration tests

快速开始

To deploy the cluster you can use :

Ansible

# Install dependencies from ``requirements.txt``
sudo pip install -r requirements.txt

# Copy ``inventory/sample`` as ``inventory/mycluster``
cp -rfp inventory/sample/* inventory/mycluster

# Update Ansible inventory file with inventory builder
declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5)
CONFIG_FILE=inventory/mycluster/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]}

# Review and change parameters under ``inventory/mycluster/group_vars``
cat inventory/mycluster/group_vars/all.yml
cat inventory/mycluster/group_vars/k8s-cluster.yml

# Deploy Kubespray with Ansible Playbook
ansible-playbook -i inventory/mycluster/hosts.ini cluster.yml

Note: When Ansible is already installed via system packages on the control machine, other python packages installed via sudo pip install -r requirements.txt will go to a different directory tree (e.g. /usr/local/lib/python2.7/dist-packages on Ubuntu) from Ansible's (e.g. /usr/lib/python2.7/dist-packages/ansible still on Ubuntu). As a consequence, ansible-playbook command will fail with:

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

probably pointing on a task depending on a module present in requirements.txt (i.e. "unseal vault").

One way of solving this would be to uninstall the Ansible package and then, to install it via pip but it is not always possible. A workaround consists of setting ANSIBLE_LIBRARY and ANSIBLE_MODULE_UTILS environment variables respectively to the ansible/modules and ansible/module_utils subdirectories of pip packages installation location, which can be found in the Location field of the output of pip show [package] before executing ansible-playbook.

Vagrant

For Vagrant we need to install python dependencies for provisioning tasks. Check if Python and pip are installed:

python -V && pip -V

If this returns the version of the software, you're good to go. If not, download and install Python from here https://www.python.org/downloads/source/ Install the necessary requirements

sudo pip install -r requirements.txt
vagrant up

Documents

Supported Linux Distributions

  • Container Linux by CoreOS
  • Debian Jessie, Stretch, Wheezy
  • Ubuntu 16.04, 18.04
  • CentOS/RHEL 7
  • Fedora 28
  • Fedora/CentOS Atomic
  • openSUSE Leap 42.3/Tumbleweed

Note: Upstart/SysV init based OS types are not supported.

Supported Components

Note: kubernetes doesn't support newer docker versions ("Version 17.03 is recommended... Versions 17.06+ might work, but have not yet been tested and verified by the Kubernetes node team" cf. Bootstrapping Clusters with kubeadm). Among other things kubelet currently breaks on docker's non-standard version numbering (it no longer uses semantic versioning). To ensure auto-updates don't break your cluster look into e.g. yum versionlock plugin or apt pin).

Note 2: rkt support as docker alternative is limited to control plane (etcd and kubelet). Docker is still used for Kubernetes cluster workloads and network plugins' related OS services. Also note, only one of the supported network plugins can be deployed for a given single cluster.

Requirements

  • Ansible v2.4 (or newer) and python-netaddr is installed on the machine that will run Ansible commands
  • Jinja 2.9 (or newer) is required to run the Ansible Playbooks
  • The target servers must have access to the Internet in order to pull docker images.
  • The target servers are configured to allow IPv4 forwarding.
  • Your ssh key must be copied to all the servers part of your inventory.
  • The firewalls are not managed, you'll need to implement your own rules the way you used to. in order to avoid any issue during deployment you should disable your firewall.
  • If kubespray is ran from non-root user account, correct privilege escalation method should be configured in the target servers. Then the ansible_become flag or command parameters --become or -b should be specified.

Network Plugins

You can choose between 6 network plugins. (default: calico, except Vagrant uses flannel)

  • flannel: gre/vxlan (layer 2) networking.

  • calico: bgp (layer 3) networking.

  • canal: a composition of calico and flannel plugins.

  • cilium: layer 3/4 networking (as well as layer 7 to protect and secure application protocols), supports dynamic insertion of BPF bytecode into the Linux kernel to implement security services, networking and visibility logic.

  • contiv: supports vlan, vxlan, bgp and Cisco SDN networking. This plugin is able to apply firewall policies, segregate containers in multiple network and bridging pods onto physical networks.

  • weave: Weave is a lightweight container overlay network that doesn't require an external K/V database cluster. (Please refer to weave troubleshooting documentation).

The choice is defined with the variable kube_network_plugin. There is also an option to leverage built-in cloud provider networking instead. See also Network checker.

Community docs and resources

Tools and projects on top of Kubespray

CI Tests

CI/end-to-end tests sponsored by Google (GCE) See the test matrix for details.

本文转载自:https://github.com/openthings/kubespray

openthings
粉丝 322
博文 1138
码字总数 687611
作品 1
东城
架构师
私信 提问
使用Kubespray 2.8.3部署生产可用的Kubernetes集群(1.12.5)

Kubernetes的安装部署是难中之难,每个版本安装方式都略有区别。笔者一直想找一种、 、 的部署方案。经过一段时间的调研,有如下几种解决方案进入笔者视野: 其他诸如Kops之类的方案,由于无...

周立_itmuch
03/07
0
0
使用Kubespray部署Kubernetes集群

版权声明:本文为博主原创文章,欢迎转载,转载请注明作者、原文超链接 ,博主地址:http://blog.csdn.net/forezp。 https://blog.csdn.net/forezp/article/details/82730382 转载请标明出处...

方志朋
2018/09/16
0
0
使用Kubespray部署生产可用的Kubernetes集群(1.11.2)

Kubernetes的安装部署是难中之难,每个版本安装方式都略有区别。笔者一直想找一种 、 、 的部署方案。经过一段时间的调研,有如下几种解决方案进入笔者视野: 部署方案 优点 缺点 Kubeadm 官...

A周立SpringCloud
2018/09/05
0
0
手把手使用Kubespray 2.8.3部署生产可用的Kubernetes集群(1.12.5)

Kubernetes的安装部署是难中之难,每个版本安装方式都略有区别。笔者一直想找一种、 、 的部署方案。经过一段时间的调研,有如下几种解决方案进入笔者视野: 部署方案 优点 缺点 Kubeadm 官方...

周立_ITMuch
03/07
37
0
OpenStack 上部署 Kubernetes 方案对比

  目前在 OpenStack 上部署 Kubernetes 有多种方式,本文会先简要描述每种方案,再使用图标进行简单的对比,并尝试给出个人认为的较优方案。 Tectonic   由 CoreOS 开发,是开源企业级的...

blackpiglet
2018/08/29
0
0

没有更多内容

加载失败,请刷新页面

加载更多

jQuery使用GET方式来进行异步请求

jQuery.get( url, [data], [callback] ):使用GET方式来进行异步请求 参数: url(String) : 发送请求的URL地址. data(Map) : (可选) 要发送给服务器的数据,以 Key/value 的键值对形式表示,...

前端老手
10分钟前
3
0
网络安全市场需求

最近,网络安全技能差距的热门话题流传开来。技能差距经常被紧急讨论,可以看出它在实践中的作用是很大的。但信息安全是一门广泛的学科,所以在谈论“技能差距”时需要更具体。有专家表示,真...

linuxCool
27分钟前
3
0
定期批量改密,实现高效运维,保障口令安全

随着企业IT资产规模的不断增大,各类主机、应用系统的管理也变得愈加困难。 对于系统管理员来说,保证操作系统的密码安全是其重要工作,在需要维护众多的主机时,其面临的困境将是: 1、难以...

堡垒啊
52分钟前
5
0
怎样在磁盘上查找MySQL表的大小?这里有答案

导读 我想知道 MySQL 表在磁盘上占用多少空间,但看起来很琐碎。不应该在 INFORMATION_SCHEMA.TABLES 中提供这些信息吗?没那么简单! 我想知道 MySQL 表在磁盘上占用多少空间,但看起来很琐碎...

问题终结者
今天
6
0
Spring Boot缓存实战 Redis 设置有效时间和自动刷新缓存-2

问题 上一篇Spring Boot Cache + redis 设置有效时间和自动刷新缓存,时间支持在配置文件中配置,说了一种时间方式,直接扩展注解的Value值,如: @Override@Cacheable(value = "people#${s...

xiaolyuh
今天
14
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部