Skip to content
 
 

Repository files navigation

kube-ansible

This project will used ansible to deployment kubernetes.

Refer to the README.md and group_vars/template.yml files for project configuration

Cloud Support

  • Azure
  • Aws(Apiserver HA use the CLB)
  • GCP(Apiserver HA use the TCP Load balancing)

OS Support

All node please install python3.

  • CentOS 7.*
  • CentOS 8.*
  • Ubuntu 16.04.*
  • Ubuntu 18.04.*
  • Ubuntu 20.04.*

Kubernetes Support

  • 1.14.x
  • 1.15.x
  • 1.16.x
  • 1.17.x
  • 1.18.x
  • 1.19.x
  • 1.20.x
  • 1.21.x

Runtime Support

  • Docker >= 18.09.0
  • Containerd >= 1.3.0

Size of master and master components

GCP

  • 1-5 nodes: n1-standard-1
  • 6-10 nodes: n1-standard-2
  • 11-100 nodes: n1-standard-4
  • 101-250 nodes: n1-standard-8
  • 251-500 nodes: n1-standard-16
  • more than 500 nodes: n1-standard-32

AWS

  • 1-5 nodes: m3.medium
  • 6-10 nodes: m3.large
  • 11-100 nodes: m3.xlarge
  • 101-250 nodes: m3.2xlarge
  • 251-500 nodes: c4.4xlarge
  • more than 500 nodes: c4.8xlarge

How to use

Preparation work

Clone code

Gitee: https://gitee.com/buxiaomo/kube-ansible.git

Gitlab: https://gitlab.com/buxiaomo/kube-ansible.git

Github: https://github.com/buxiaomo/kube-ansible.git

# ubuntu
apt install git make -y
# centos
yum install git make vim -y
git clone https://github.com/buxiaomo/kube-ansible.git /usr/local/src/kube-ansible
cd /usr/local/src/kube-ansible

Install ansible

if python3 not install on other node, please run command ansible-playbook fix-python3.yml or curl -s https://bootstrap.pypa.io/pip/get-pip.py | python3.

make runtime

Download the way

  • nexus

    if you don't have internet, you can run scripts/upload-nexus.py script on internet virtual machine and upload to nexus.

  • official

    It will be download from Github or Google

  • qiniu

    this is a mirrors on qiniu, you can reference here

about Makefile parameter

Parameter describe Default option
DOWNLOAD_WAY Binary download mode official official or nexus or qiniu
RUNTIME container runtime docker docker or containerd
CONTAINERD_VERSION containerd binary version 1.3.0 N/A
CRICTL_VERSION crictl binary version 1.16.1 N/A
RUNC_VERSION runc binary version 1.0.0-rc92 N/A
KUBE_VERSION Kubernetes binary version 1.20.0 N/A
DOCKER_VERSION Docker binary version 19.03.9 N/A
ETCD_VERSION Etcd binary version 3.4.5 N/A
CNI_VERSION CNI binary version 0.8.5 N/A
NEXUS_HTTP_USERNAME Nexus username N/A N/A
NEXUS_HTTP_PASSWORD Nexus password N/A N/A
NEXUS_DOMAIN_NAME Nexus domain name N/A N/A
NEXUS_REPOSITORY Nexus repository name kube-ansible N/A
Download the default version using official
make install DOWNLOAD_WAY=official
Download the default version using Qiniu
make install DOWNLOAD_WAY=qiniu
Download the default version using Nexus
make install DOWNLOAD_WAY=nexus \
NEXUS_DOMAIN_NAME=172.16.0.206:8081 \
NEXUS_REPOSITORY=kube-ansible \
NEXUS_HTTP_USERNAME=admin \
NEXUS_HTTP_PASSWORD=admin

Kubernetes management

Deploy

asciicast

# default version
## docker runtime
make install DOWNLOAD_WAY=official RUNTIME=docker

## containerd runtime
make install DOWNLOAD_WAY=official RUNTIME=containerd

# custom version
## docker runtime
make install DOWNLOAD_WAY=official RUNTIME=docker KUBE_VERSION=1.14.4 DOCKER_VERSION=19.03.8 FLANNEL_VERSION=0.12.0 ETCD_VERSION=3.4.5

## containerd runtime
make install DOWNLOAD_WAY=official RUNTIME=containerd KUBE_VERSION=1.14.4 DOCKER_VERSION=19.03.8 FLANNEL_VERSION=0.12.0 ETCD_VERSION=3.4.5

Scale

add node to hosts file.

# default version
make scale

# custom version
make scale KUBE_VERSION=1.16.8 DOCKER_VERSION=19.03.8 FLANNEL_VERSION=0.12.0 ETCD_VERSION=3.4.5

Upgrade

Download new kubernetes binaries, Reference here.

make upgrade KUBE_VERSION=1.18.5

Kubernetes Extended application

This repo only deploy a kubernetes cluster and core application like 'coredns', 'calico', 'canal', 'flannel', not support extended application, like 'jenkins', 'ingress'...

if you want to deploy extended application, please reference here.

about nexus package

create an raw repository, and upload the binaries package.

you can use scripts/upload-nexus.py file

component attributes of directory format:

  • /linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz
  • /coreos/flannel/releases/download/${FLANNEL_VERSION}/flannel-v${FLANNEL_VERSION}-linux-amd64.tar.gz
  • /coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kube-apiserver
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kube-controller-manager
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kube-scheduler
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kubectl
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kube-proxy
  • /kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kubelet

knowledge

About

Deploy kubernetes binaries with ansible

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages