High-availability kubernetes cluster-16. Ansible Rapid Deployment

Source: Internet
Author: User
Tags haproxy etcd k8s ansible playbook

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

    1. Number of cluster servers recommendation:3; document with 172.30.200.51~53 example, 172.30.200.50 as VIP;
    2. To reduce the number of servers, the use of All-in-one, the role of service integration deployment;
    3. The front-end adopts haproxy+keepalived to do high availability;
    4. K/V database adopts ETCD cluster;
    5. Kubernetes-master role components: Kube-apiserver,kube-controller-manager,kube-scheduler;
    6. 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:
    • Physical machine or virtual machine;
    • Minimize the installation, set the IP address, start the SSH service can be;
    • Host can access the Internet, otherwise you need to initialize host (such as the virtual machine, can be mirrored by the unified initialization, initialization step reference "~/k8s-ansible/playbooks/roles/ Initenv/tasks/main.yaml ");
    • The configuration is as follows:

      IP CPU (Cores) Memory (GB) Remark
      172.30.200.51 4 4 Adjust resource usage, as appropriate, based on actual deployment situation
      172.30.200.52 4 4
      172.30.200.53 4 4
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.