Advantages
- available for aws, ace, azure, openstack or bare metal
- available HA cluster
- can chose the network plugin
- 인기있는 linux 배포판 지원
requirements
- Support OS :
- core os
- debian jessie
- ubuntu <= 16.04
- centos/rhel <= 7
versions - 컴포넌트 버전
- kubernetes <= 1.6.4
- etc 3.0.17
- flannels 0.6.2
- calicoctl 0.23.0
- canal calico/flannel 버전과 동일
- weave 1.8.2
- docker 1.13.1
- rat 1.21.0
prerequisite - 필수조건
- ansible은 2.3이상
- python-netaddr은 설치되어있어야 함
- ninja 2.9 이상 필요함
- target server는 인터넷이 되고 ipv4 forwarding이 되어야 함
- ssh key는 인벤토리에 복사되어야 함
supported network plugin
- flannel
- calico
- canal
- weave
Install a kubernetes cluster using kubespray - 설치
install a ansible
$ sudo apt-get install ansible
$ ansible --version
ansible 2.3.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/ansible']
python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
$ sudo apt-get install python-netaddr
clone a kubespray git repo
$ git clone https://github.com/kubernetes-incubator/kubespray.git
$ cd kubespray
$ cp -r inventory myinventory
$ ips=(host248 host173 host183 host153)
$ CONFIG_FILE=myinventory/inventory.cfg python3 contrib/inventory_builder/inventory.py ${ips[@]}
DEBUG: Adding group all
DEBUG: Adding group kube-master
DEBUG: Adding group kube-node
DEBUG: Adding group etcd
DEBUG: Adding group k8s-cluster:children
DEBUG: Adding group calico-rr
DEBUG: adding host node1 to group all
DEBUG: adding host node2 to group all
DEBUG: adding host node3 to group all
DEBUG: adding host node4 to group all
DEBUG: adding host kube-node to group k8s-cluster:children
DEBUG: adding host kube-master to group k8s-cluster:children
DEBUG: adding host node1 to group etcd
DEBUG: adding host node2 to group etcd
DEBUG: adding host node3 to group etcd
DEBUG: adding host node1 to group kube-master
DEBUG: adding host node2 to group kube-master
DEBUG: adding host node1 to group kube-node
DEBUG: adding host node2 to group kube-node
DEBUG: adding host node3 to group kube-node
DEBUG: adding host node4 to group kube-node
check the inventory.cfg generated by inventory.py
$ vi inventory/inventory.cfg
[kube-master]
node1
node2
[etcd]
node1
node2
node3
[kube-node]
node2
node3
node4
node1
[k8s-cluster:children]
kube-node
kube-master
[all]
node1 ansible_host=host248 ip=172.10.30.248
node2 ansible_host=host173 ip=172.10.30.173
node3 ansible_host=host183 ip=172.10.30.183
node4 ansible_host=host153 ip=172.10.30.153
run cluster.yml playbook
$ ansible-playbook -i myinventory/inventory.cfg cluster.yml -b -v --private-key=~/k8s-dev.pem
...
ubuntu@host248:~$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
KubeDNS is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kube-dns
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
ubuntu@host248:~$ kubectl get cs
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}
etcd-1 Healthy {"health": "true"}
ubuntu@host248:~$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system flannel-ip-host153 1/1 Running 1 1d
kube-system flannel-ip-host183 1/1 Running 1 1d
kube-system flannel-ip-host248 1/1 Running 1 1d
kube-system flannel-ip-host173 1/1 Running 1 1d
kube-system kube-apiserver-ip-host248 1/1 Running 0 1d
kube-system kube-apiserver-ip-host173 1/1 Running 0 1d
kube-system kube-controller-manager-ip-host248 1/1 Running 1 1d
kube-system kube-controller-manager-ip-host173 1/1 Running 1 1d
kube-system kube-dns-3841192733-vf5xm 3/3 Running 0 1d
kube-system kube-dns-3841192733-xm1xr 3/3 Running 0 1d
kube-system kube-proxy-ip-host153 1/1 Running 1 1d
kube-system kube-proxy-ip-host183 1/1 Running 1 1d
kube-system kube-proxy-ip-host248 1/1 Running 1 1d
kube-system kube-proxy-ip-host173 1/1 Running 1 1d
kube-system kube-scheduler-ip-host248 1/1 Running 0 1d
kube-system kube-scheduler-ip-host173 1/1 Running 0 1d
kube-system kubedns-autoscaler-1833630871-x52k5 1/1 Running 0 1d
kube-system nginx-proxy-ip-host153 1/1 Running 1 1d
kube-system nginx-proxy-ip-host183 1/1 Running 1 1d
pros and cons for me
장점
- sensible-playbook을 이용한 설치로 안정적이고 편리함
- 클러스터 생성/확장 모든 내용 지원가능
- master ha 지원함
- 모든 플랫폼(public/private/baremetal) 지원가능
단점
- 아직 인큐베이팅 프로젝트이므로 어떻게 될지 모름
- 우리에 맞게 사용하려면 수정이 필요할 것으로 예상됨