mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
coreos/azure: Make etcd cluster scalable
This commit is contained in:
parent
d882ad5411
commit
7b8abf3cbb
@ -39,7 +39,6 @@ coreos:
|
|||||||
Environment=ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
|
Environment=ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
|
||||||
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%H:2379,http://%H:4001
|
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%H:2379,http://%H:4001
|
||||||
Environment=ETCD_INITIAL_CLUSTER_STATE=new
|
Environment=ETCD_INITIAL_CLUSTER_STATE=new
|
||||||
Environment=ETCD_INITIAL_CLUSTER=etcd-00=http://etcd-00:2380,etcd-01=http://etcd-01:2380,etcd-02=http://etcd-02:2380
|
|
||||||
ExecStart=/opt/bin/etcd2
|
ExecStart=/opt/bin/etcd2
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
|
@ -244,7 +244,7 @@ coreos:
|
|||||||
ExecStart=/opt/kubernetes/server/bin/kube-apiserver \
|
ExecStart=/opt/kubernetes/server/bin/kube-apiserver \
|
||||||
--address=0.0.0.0 \
|
--address=0.0.0.0 \
|
||||||
--port=8080 \
|
--port=8080 \
|
||||||
--etcd_servers=http://etcd-00:4001,http://etcd-01:4001,http://etcd-02:4001 \
|
$ETCD_SERVERS \
|
||||||
--portal_net=10.1.0.0/16 \
|
--portal_net=10.1.0.0/16 \
|
||||||
--cloud_provider=vagrant \
|
--cloud_provider=vagrant \
|
||||||
--logtostderr=true --v=3
|
--logtostderr=true --v=3
|
||||||
|
@ -5,15 +5,51 @@ var util = require('../util.js');
|
|||||||
var cloud_config = require('../cloud_config.js');
|
var cloud_config = require('../cloud_config.js');
|
||||||
|
|
||||||
|
|
||||||
|
etcd_initial_cluster_conf_self = function (conf) {
|
||||||
|
var port = '2380';
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
nodes: _(conf.nodes.etcd).times(function (n) {
|
||||||
|
var host = util.hostname(n, 'etcd');
|
||||||
|
return [host, [host, port].join(':')].join('=http://');
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
'name': 'etcd2.service',
|
||||||
|
'drop-ins': [{
|
||||||
|
'name': '50-etcd-initial-cluster.conf',
|
||||||
|
'content': _.template("[Service]\nEnvironment=ETCD_INITIAL_CLUSTER=<%= nodes.join(',') %>\n")(data),
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
etcd_initial_cluster_conf_kube = function (conf) {
|
||||||
|
var port = '4001';
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
nodes: _(conf.nodes.etcd).times(function (n) {
|
||||||
|
var host = util.hostname(n, 'etcd');
|
||||||
|
return 'http://' + [host, port].join(':');
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
'name': 'apiserver.service',
|
||||||
|
'drop-ins': [{
|
||||||
|
'name': '50-etcd-initial-cluster.conf',
|
||||||
|
'content': _.template("[Service]\nEnvironment=ETCD_SERVERS=--etcd_servers=<%= nodes.join(',') %>\n")(data),
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
exports.create_etcd_cloud_config = function (node_count, conf) {
|
exports.create_etcd_cloud_config = function (node_count, conf) {
|
||||||
var input_file = './cloud_config_templates/kubernetes-cluster-etcd-node-template.yml';
|
var input_file = './cloud_config_templates/kubernetes-cluster-etcd-node-template.yml';
|
||||||
|
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-nodes', 'generated.yml');
|
||||||
|
|
||||||
return _(node_count).times(function (n) {
|
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||||
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-node-' + n, 'generated.yml');
|
data.coreos.units.push(etcd_initial_cluster_conf_self(conf));
|
||||||
|
return data;
|
||||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,8 +67,10 @@ exports.create_node_cloud_config = function (node_count, conf) {
|
|||||||
bridge_address_cidr: util.ipv4([10, 2, n, 1], 24),
|
bridge_address_cidr: util.ipv4([10, 2, n, 1], 24),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||||
data.write_files = data.write_files.concat(_(node_count).times(make_node_config));
|
data.write_files = data.write_files.concat(_(node_count).times(make_node_config));
|
||||||
|
data.coreos.units.push(etcd_initial_cluster_conf_kube(conf));
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user