Description
This document directs the use of binary packages to rapidly deploy highly available kubernetes clusters.
Script hosting: k8s-ansible
Reference: high-availability kubernetes clusters
Component version
Components |
version |
Notes |
Centos |
7.5 |
Linux kernel version not less than 3.10, this document is based on the CentOS release version |
Haproxy |
1.8.13 |
Version is optional, this document is by default in 1.8.13 version |
Keepalived |
2.0.6 |
Version is optional, this document is by default in 2.0.6 version |
Docker |
18.06.1.ce |
Version is optional, this document is version 18.06.1.ce by default |
Cfssl |
R1.2 |
Version is optional, this document is by default in r.12 version |
Etcd |
v3.3.9 |
Version is optional, this document is by default in v3.3.9 version |
Flannel |
v0.10.0 |
Version is optional, this document is by default in v0.10.0 version |
Kubernetes |
v1.11.2 |
Version is optional, this document is by default in v1.11.2 version |
Kube-dns |
1.14.10 |
This document is by default in the 1.14.10 version |
Dashboard |
1.8.3 |
This document is by default in the 1.8.3 version |
Heapster |
v1.5.4 |
This document is by default in the v1.5.4 version |
Influxdb |
v1.5.2 |
This document is by default in the v1.5.2 version |
Grafana |
v5.0.4 |
This document is by default in the v5.0.4 version |
Logical topology
- Number of cluster servers recommendation:3; document with 172.30.200.51~53 example, 172.30.200.50 as VIP;
- To reduce the number of servers, the use of All-in-one, the role of service integration deployment;
- The front-end adopts haproxy+keepalived to do high availability;
- K/V database adopts ETCD cluster;
- Kubernetes-master role components: Kube-apiserver,kube-controller-manager,kube-scheduler;
- Kubernetes-minion role component: Kubelet,kube-proxy.
Usage Instructions Environment Preparation
- Prepare 1 ansible-server (main control side):
- communication with Ansible-client ;
- Access to the Internet (if not accessible, you can download the relevant package in advance to upload to the specified directory, can refer to "~/k8s-ansible/download.sh");
- There is theoretically no hardware requirement.
- Depending on the plan, several host hosts are prepared as ansible-client (controlled side) and the number of hosts in this document is 3:
Operation Guide
The following actions, if not specifically stated, are performed in the root account of the selected ansible-server.
1. Installing Ansible-server
yum install ansible -y
2. Set Ansible-server password-free login ansible-client
Ansible the use of agentless operation of the controlled side, the default uses SSH protocol to the control end of the management, in order to avoid the issuance of instructions to enter the target host password, the use of signing certificates can SSH to the target host.
- Ssh-keygen: When generating the secret key (including the public/private key), use the default settings, enter;
Ssh-copy-id: The target host password is required to distribute the public key to all target hosts, note the ansible-client format in the For loop.
ssh-keygen -t rsafor i in "172.30.200.51" "172.30.200.52" "172.30.200.53"; do ssh-copy-id [email protected]$i; done
3. Pull the installation script
Important: Pull the installation script in the "~/" directory where the account is running .
# 安装或升级gityum install git -y# 拉取安装脚本,注意脚本的保存目录cd ~git clone https://github.com/Netonline2016/k8s-ansible.git
4. Download the installation package
In order to avoid the installation process, the network download installation package time-out or wait too long, download the appropriate packages in advance, and placed in the corresponding path, this process has been organized into shell script, can be run directly.
If you have version requirements for the package, you can modify it in the script, see the "~/k8s-ansible/download.sh" script comment.
sh ~/k8s-ansible/download.sh
5. Define host variables according to the plan
For documentation, please see the appropriate documentation for comments:
- ~/k8s-ansible/inventory/hosts
- ~/k8s-ansible/inventory/group_vars/all
6. Deploy a highly available kubernetes cluster
Run an automated installation using the Ansible Playbook method.
ansible-playbook -i ~/k8s-ansible/inventory/hosts ~/k8s-ansible/playbooks/k8s-ansible.yaml
High-availability kubernetes cluster-16. Ansible Rapid Deployment