
Currently, the list of minions is statically specified in master node, and the list of IP addresses of minion nodes is passed to master node through user_data. This approach doesn't work well on scaling. For example, adding a minion node through stack-update will cause an update on user_data, which cause the master node to be replaced. This commit addresses this issue by dynamically register minion node. There are two cases: * Scale out: the new minion nodes will register themselves to the cluster when they are booting. * Scale in: a subset of minion nodes are deleted by Heat, and the master node will discover it and automatically deregister the deleted nodes.
20 lines
451 B
Bash
20 lines
451 B
Bash
#!/bin/sh
|
|
|
|
. /etc/sysconfig/heat-params
|
|
|
|
echo "configuring kubernetes (master)"
|
|
|
|
sed -i '
|
|
/^KUBE_ALLOW_PRIV=/ s/=.*/="--allow_privileged='"$KUBE_ALLOW_PRIV"'"/
|
|
' /etc/kubernetes/config
|
|
|
|
sed -i '
|
|
/^KUBE_API_ADDRESS=/ s/=.*/="--address=0.0.0.0"/
|
|
/^KUBE_SERVICE_ADDRESSES=/ s|=.*|="--portal_net='"$PORTAL_NETWORK_CIDR"'"|
|
|
' /etc/kubernetes/apiserver
|
|
|
|
sed -i '
|
|
/^KUBELET_ADDRESSES=/ s/=.*/="--machines='""'"/
|
|
' /etc/kubernetes/controller-manager
|
|
|