- Introduction
- Installation
- 0. Regenerate CA certs (Optional)
- 1. Check connectivity
- 2. Init host
- 3. Install docker (Required)
- 4. Deploy etcd (Required)
- 5. Deploy VIP & load balancer for kube-apiserver (Optional if all-in-one)
- 6. Install Kubernetes basic components (Required)
- 7. Install calico & kubedns (Required)
- 8. Install other addons (Optional)
- 9. Install ingress (Optional)
This repo is used to deploy product-grade high availability Kubernetes cluster, as well as all-in-one cluster.
kube-deploy has experienced long time validation in our internal clusters, to help more people to deploy their Kubernetes, we decide to make it open source.
So, please have a try! if have any issue, please let us know.
At the begining, we should install Ansible(ver2.0+) in our deploy workstation. Then follow us to deploy the Kubernetes cluster.
Note here, if you want to create your CA certs to instead of the default one in this repo, please regenerate it as following steps.
$ cd roles/common/files/pki
# notice: need install cfssl
# https://kubernetes.io/docs/concepts/cluster-administration/certificates/#cfssl
$ /usr/bin/bash generate-ca.sh
Please check your deploy workstation would ssh to the remote Host, maybe need --sudo
$ ansible --inventory='hosts/kube.ini' nodes -m ping
-
- Upgrade kernel to elrepo-lt (Recommend)
# centos # upgrade kernel to elrepo-lt for docker cgroup driver systemd ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='upgrade-kernel' ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='reboot' # upgrade system package ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='upgrade-pkg' # ubuntu # ubuntu does not need to upgrade kernel ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='upgrade-pkg'
-
- Install dependency tools and requirements
# install some commonly used software packages, etc. ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='dep'
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='docker'
# deploy etcd with docker
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='etcds' --tags='etcd'
NOTE: PLEASE IGNORE THIS STEP, IF YOU WANT TO DEPLOY AN ALL-IN-ONE KUBERNETES CLUSTER.
# use keepalived to provide kube-apiserver vip and use haproxy to provide kube-apiserver load balancer
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='vips' --tags='vip'
# up kubernetes master node and worker node
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='nodes' --tags='kube'
# deploy calico
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='masters' --tags='calico'
# deploy kube-dns
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='masters' --tags='dns'
# deploy metric-server for HPA
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='masters' --tags='metric-server'
# no need to execute on single master node architecture
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='ingress_nginxs_l7' --tags='ingress'
# no need to execute on single master node architecture
ansible-playbook kube.yaml --inventory='hosts/kube.ini' --limit='ingress_nginxs_l4' --tags='ingress'