mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
update azure coreos to kubernetes 0.15.0
add affinity group variable to azure coreos scripts
This commit is contained in:
parent
01b891770f
commit
314bd39747
@ -2,16 +2,48 @@
|
|||||||
## More specifically, we need to add peer hosts for each but the elected peer.
|
## More specifically, we need to add peer hosts for each but the elected peer.
|
||||||
|
|
||||||
coreos:
|
coreos:
|
||||||
etcd:
|
|
||||||
name: etcd
|
|
||||||
addr: $private_ipv4:4001
|
|
||||||
bind-addr: 0.0.0.0
|
|
||||||
peer-addr: $private_ipv4:7001
|
|
||||||
snapshot: true
|
|
||||||
max-retry-attempts: 50
|
|
||||||
units:
|
units:
|
||||||
- name: etcd.service
|
- name: download-etcd2.service
|
||||||
|
enable: true
|
||||||
command: start
|
command: start
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
After=network-online.target
|
||||||
|
Before=etcd2.service
|
||||||
|
Description=Download etcd2 Binaries
|
||||||
|
Documentation=https://github.com/coreos/etcd/
|
||||||
|
Requires=network-online.target
|
||||||
|
[Service]
|
||||||
|
Environment=ETCD2_RELEASE_TARBALL=https://github.com/coreos/etcd/releases/download/v2.0.9/etcd-v2.0.9-linux-amd64.tar.gz
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/bin
|
||||||
|
ExecStart=/bin/bash -c "curl --silent --location $ETCD2_RELEASE_TARBALL | tar xzv -C /opt"
|
||||||
|
ExecStartPost=/bin/ln -s /opt/etcd-v2.0.9-linux-amd64/etcd /opt/bin/etcd2
|
||||||
|
ExecStartPost=/bin/ln -s /opt/etcd-v2.0.9-linux-amd64/etcdctl /opt/bin/etcdctl2
|
||||||
|
RemainAfterExit=yes
|
||||||
|
Type=oneshot
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
- name: etcd2.service
|
||||||
|
enable: true
|
||||||
|
command: start
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
After=download-etcd2.service
|
||||||
|
Description=etcd 2
|
||||||
|
Documentation=https://github.com/coreos/etcd/
|
||||||
|
[Service]
|
||||||
|
Environment=ETCD_NAME=%host%
|
||||||
|
Environment=ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
|
||||||
|
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%host%:2380
|
||||||
|
Environment=ETCD_LISTEN_PEER_URLS=http://%host%:2380
|
||||||
|
Environment=ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
|
||||||
|
Environment=ETCD_INITIAL_CLUSTER=%cluster%
|
||||||
|
Environment=ETCD_INITIAL_CLUSTER_STATE=new
|
||||||
|
ExecStart=/opt/bin/etcd2
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
update:
|
update:
|
||||||
group: stable
|
group: stable
|
||||||
reboot-strategy: off
|
reboot-strategy: off
|
||||||
|
@ -18,9 +18,37 @@ write_files:
|
|||||||
printf '{ "id": "%s", "kind": "Minion", "apiVersion": "v1beta1", "labels": { "environment": "production" } }' "${minion_id}" \
|
printf '{ "id": "%s", "kind": "Minion", "apiVersion": "v1beta1", "labels": { "environment": "production" } }' "${minion_id}" \
|
||||||
| /opt/bin/kubectl create -s "${master_url}" -f -
|
| /opt/bin/kubectl create -s "${master_url}" -f -
|
||||||
|
|
||||||
|
- path: /etc/kubernetes/manifests/fluentd.manifest
|
||||||
|
permissions: '0755'
|
||||||
|
owner: root
|
||||||
|
content: |
|
||||||
|
version: v1beta2
|
||||||
|
id: fluentd-to-elasticsearch
|
||||||
|
containers:
|
||||||
|
- name: fluentd-es
|
||||||
|
image: gcr.io/google_containers/fluentd-elasticsearch:1.3
|
||||||
|
env:
|
||||||
|
- name: FLUENTD_ARGS
|
||||||
|
value: -qq
|
||||||
|
volumeMounts:
|
||||||
|
- name: containers
|
||||||
|
mountPath: /var/lib/docker/containers
|
||||||
|
- name: varlog
|
||||||
|
mountPath: /varlog
|
||||||
|
volumes:
|
||||||
|
- name: containers
|
||||||
|
source:
|
||||||
|
hostDir:
|
||||||
|
path: /var/lib/docker/containers
|
||||||
|
- name: varlog
|
||||||
|
source:
|
||||||
|
hostDir:
|
||||||
|
path: /var/log
|
||||||
|
|
||||||
coreos:
|
coreos:
|
||||||
update:
|
update:
|
||||||
group: stable
|
group: stable
|
||||||
|
reboot-strategy: off
|
||||||
units:
|
units:
|
||||||
- name: docker.service
|
- name: docker.service
|
||||||
drop-ins:
|
drop-ins:
|
||||||
@ -187,7 +215,7 @@ coreos:
|
|||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
[Service]
|
[Service]
|
||||||
Environment=KUBE_RELEASE_TARBALL=https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.11.0/kubernetes.tar.gz
|
Environment=KUBE_RELEASE_TARBALL=https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.15.0/kubernetes.tar.gz
|
||||||
ExecStartPre=/bin/mkdir -p /opt/
|
ExecStartPre=/bin/mkdir -p /opt/
|
||||||
ExecStart=/bin/bash -c "curl --silent --location $KUBE_RELEASE_TARBALL | tar xzv -C /tmp/"
|
ExecStart=/bin/bash -c "curl --silent --location $KUBE_RELEASE_TARBALL | tar xzv -C /tmp/"
|
||||||
ExecStart=/bin/tar xzvf /tmp/kubernetes/server/kubernetes-server-linux-amd64.tar.gz -C /opt
|
ExecStart=/bin/tar xzvf /tmp/kubernetes/server/kubernetes-server-linux-amd64.tar.gz -C /opt
|
||||||
@ -278,12 +306,16 @@ coreos:
|
|||||||
Wants=download-kubernetes.service
|
Wants=download-kubernetes.service
|
||||||
ConditionHost=!kube-00
|
ConditionHost=!kube-00
|
||||||
[Service]
|
[Service]
|
||||||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests/
|
||||||
ExecStart=/opt/kubernetes/server/bin/kubelet \
|
ExecStart=/opt/kubernetes/server/bin/kubelet \
|
||||||
--address=0.0.0.0 \
|
--address=0.0.0.0 \
|
||||||
--port=10250 \
|
--port=10250 \
|
||||||
--hostname_override=%H \
|
--hostname_override=%H \
|
||||||
--api_servers=http://kube-00:8080 \
|
--api_servers=http://kube-00:8080 \
|
||||||
--logtostderr=true
|
--logtostderr=true \
|
||||||
|
--cluster_dns=10.1.0.3 \
|
||||||
|
--cluster_domain=kube.local \
|
||||||
|
--config=/etc/kubernetes/manifests/
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -13,9 +13,9 @@ var inspect = require('util').inspect;
|
|||||||
var util = require('./util.js');
|
var util = require('./util.js');
|
||||||
|
|
||||||
var coreos_image_ids = {
|
var coreos_image_ids = {
|
||||||
'stable': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Stable-607.0.0',
|
'stable': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Stable-633.1.0',
|
||||||
'beta': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Beta-612.1.0', // untested
|
'beta': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Beta-647.0.0', // untested
|
||||||
'alpha': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Alpha-626.0.0', // untested
|
'alpha': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Alpha-647.0.0' // untested
|
||||||
};
|
};
|
||||||
|
|
||||||
var conf = {};
|
var conf = {};
|
||||||
@ -140,7 +140,9 @@ var create_ssh_conf = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var get_location = function () {
|
var get_location = function () {
|
||||||
if (process.env['AZ_LOCATION']) {
|
if (process.env['AZ_AFFINITY']) {
|
||||||
|
return '--affinity-group=' + process.env['AZ_AFFINITY'];
|
||||||
|
} else if (process.env['AZ_LOCATION']) {
|
||||||
return '--location=' + process.env['AZ_LOCATION'];
|
return '--location=' + process.env['AZ_LOCATION'];
|
||||||
} else {
|
} else {
|
||||||
return '--location=West Europe';
|
return '--location=West Europe';
|
||||||
|
@ -1,22 +1,29 @@
|
|||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
_.mixin(require('underscore.string').exports());
|
||||||
|
|
||||||
var util = require('../util.js');
|
var util = require('../util.js');
|
||||||
var cloud_config = require('../cloud_config.js');
|
var cloud_config = require('../cloud_config.js');
|
||||||
|
|
||||||
|
|
||||||
exports.create_etcd_cloud_config = function (node_count, conf) {
|
exports.create_etcd_cloud_config = function (node_count, conf) {
|
||||||
var elected_node = 0;
|
|
||||||
|
|
||||||
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 peers = [ ];
|
||||||
|
for (var i = 0; i < node_count; i++) {
|
||||||
|
peers.push(util.hostname(i, 'etcd') + '=http://' + util.hostname(i, 'etcd') + ':2380');
|
||||||
|
}
|
||||||
|
var cluster = peers.join(',');
|
||||||
|
|
||||||
return _(node_count).times(function (n) {
|
return _(node_count).times(function (n) {
|
||||||
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-node-' + n, 'generated.yml');
|
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-node-' + n, 'generated.yml');
|
||||||
|
|
||||||
return cloud_config.process_template(input_file, output_file, function(data) {
|
return cloud_config.process_template(input_file, output_file, function(data) {
|
||||||
if (n !== elected_node) {
|
for (var i = 0; i < data.coreos.units.length; i++) {
|
||||||
data.coreos.etcd.peers = [
|
var unit = data.coreos.units[i];
|
||||||
util.hostname(elected_node, 'etcd'), 7001
|
if (unit.name === 'etcd2.service') {
|
||||||
].join(':');
|
unit.content = _.replaceAll(_.replaceAll(unit.content, '%host%', util.hostname(n, 'etcd')), '%cluster%', cluster);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user