Abstract
Multiple zone minion nodes share the same master node (api server, etcd and etc). Need to seriously considering the high availability of master node. Nodes is labeled by different zone and failure-domain to allow distribute workload across zones.
PV Affinity is used for zone awareness. But PV affinity is not ready. Most cloud providers (at least GCE and AWS) cannot attach their persistent volumes across zones. Thus when a pod is being scheduled, if there is a volume
attached, that will dictate the zone. This will be implemented using a new
scheduler predicate (a hard constraint):VolumeZonePredicate
.
The PV is also labeled with the zone & region it was created in. For version 1.3.4, dynamic persistent volumes are always created in the zone of the cluster master (here us-central1-a / us-west-2a); this will be improved in a future version (issue #23330.).Current kube-up.sh scripts depends on kube-up/kube-down/kube-push implementation and SDK of cloudprovider. gce and aws are supported well, but not for other cloudprovider today. (v1.3.4)
Alternative solution to setup an multiple availability zone with simple cloudprovider ubuntu/centos.
4.1 Key spec
- share etcd
- share flannel network
- share docker registry
share apiserver. MASTER_INTERNAL_IP=172.20.0.9
4.2 Solution
Create VM firslty, then kube-up.sh an ubuntu (centos) worker only to reuse the same master.
Prerequisite
pip install --upgrade aws-cli
Init install
curl -sS https://get.k8s.io | MULTIZONE=true KUBERNETES_PROVIDER=aws KUBE_AWS_ZONE=us-west-2 NUM_NODES=1 bash
Setup an multizone cluster on aws
Setup 1 node from zone us-west-2
MULTIZONE=true KUBERNETES_PROVIDER=aws KUBE_AWS_ZONE=us-west-2a NUM_NODES=1 ./cluster/kube-up.sh
Add 1 node cluster from zone us-west-2a
KUBE_USE_EXISTING_MASTER=true MULTIZONE=true KUBERNETES_PROVIDER=aws KUBE_AWS_ZONE=us-west-2b NUM_NODES=1 KUBE_SUBNET_CIDR=172.20.1.0/24 MASTER_INTERNAL_IP=172.20.0.9 kubernetes/cluster/kube-up.sh
Nodes labels for availability zone
|
|
Create PV with zone affinity, provisioned at zone of master node
|
|
|
|
Destroy multiple-zone cluster
|
|
Multiple cluster management
|
|