mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #20482 from eljefedelrodeodeljefe/doc/azure-subscription-option
Auto commit by PR queue bot
This commit is contained in:
commit
bc36f57a68
@ -78,6 +78,13 @@ Now, all you need to do is:
|
|||||||
```
|
```
|
||||||
|
|
||||||
This script will provision a cluster suitable for production use, where there is a ring of 3 dedicated etcd nodes: 1 kubernetes master and 2 kubernetes nodes. The `kube-00` VM will be the master, your work loads are only to be deployed on the nodes, `kube-01` and `kube-02`. Initially, all VMs are single-core, to ensure a user of the free tier can reproduce it without paying extra. I will show how to add more bigger VMs later.
|
This script will provision a cluster suitable for production use, where there is a ring of 3 dedicated etcd nodes: 1 kubernetes master and 2 kubernetes nodes. The `kube-00` VM will be the master, your work loads are only to be deployed on the nodes, `kube-01` and `kube-02`. Initially, all VMs are single-core, to ensure a user of the free tier can reproduce it without paying extra. I will show how to add more bigger VMs later.
|
||||||
|
If you need to pass Azure specific options for the creation script you can do this via additional environment variables e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
AZ_SUBSCRIPTION=<id> AZ_LOCATION="East US" ./create-kubernetes-cluster.js
|
||||||
|
# or
|
||||||
|
AZ_VM_COREOS_CHANNEL=beta ./create-kubernetes-cluster.js
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -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-766.4.0',
|
'stable': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Stable-835.12.0', // untested
|
||||||
'beta': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Beta-766.4.0', // untested
|
'beta': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Beta-899.6.0',
|
||||||
'alpha': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Alpha-815.0.0' // untested
|
'alpha': '2b171e93f07c4903bcad35bda10acf22__CoreOS-Alpha-942.0.0' // untested
|
||||||
};
|
};
|
||||||
|
|
||||||
var conf = {};
|
var conf = {};
|
||||||
@ -159,11 +159,18 @@ var get_vm_size = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var get_subscription= function () {
|
||||||
|
if (process.env['AZ_SUBSCRIPTION']) {
|
||||||
|
return '--subscription=' + process.env['AZ_SUBSCRIPTION'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.queue_default_network = function () {
|
exports.queue_default_network = function () {
|
||||||
task_queue.push([
|
task_queue.push([
|
||||||
'network', 'vnet', 'create',
|
'network', 'vnet', 'create',
|
||||||
get_location(),
|
get_location(),
|
||||||
'--address-space=172.16.0.0',
|
'--address-space=172.16.0.0',
|
||||||
|
get_subscription(),
|
||||||
conf.resources['vnet'],
|
conf.resources['vnet'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -175,6 +182,7 @@ exports.queue_storage_if_needed = function() {
|
|||||||
'storage', 'account', 'create',
|
'storage', 'account', 'create',
|
||||||
'--type=LRS',
|
'--type=LRS',
|
||||||
get_location(),
|
get_location(),
|
||||||
|
get_subscription(),
|
||||||
conf.resources['storage_account'],
|
conf.resources['storage_account'],
|
||||||
]);
|
]);
|
||||||
process.env['AZURE_STORAGE_ACCOUNT'] = conf.resources['storage_account'];
|
process.env['AZURE_STORAGE_ACCOUNT'] = conf.resources['storage_account'];
|
||||||
@ -195,6 +203,7 @@ exports.queue_machines = function (name_prefix, coreos_update_channel, cloud_con
|
|||||||
'--virtual-network-name=' + conf.resources['vnet'],
|
'--virtual-network-name=' + conf.resources['vnet'],
|
||||||
'--no-ssh-password',
|
'--no-ssh-password',
|
||||||
'--ssh-cert=' + conf.resources['ssh_key']['pem'],
|
'--ssh-cert=' + conf.resources['ssh_key']['pem'],
|
||||||
|
get_subscription(),
|
||||||
];
|
];
|
||||||
|
|
||||||
var cloud_config = cloud_config_creator(x, conf);
|
var cloud_config = cloud_config_creator(x, conf);
|
||||||
@ -219,6 +228,9 @@ exports.queue_machines = function (name_prefix, coreos_update_channel, cloud_con
|
|||||||
if (conf.resizing && n < conf.old_size) {
|
if (conf.resizing && n < conf.old_size) {
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
|
if (process.env['AZ_VM_COREOS_CHANNEL']) {
|
||||||
|
coreos_update_channel = process.env['AZ_VM_COREOS_CHANNEL']
|
||||||
|
}
|
||||||
return vm_create_base_args.concat(next_host(n), [
|
return vm_create_base_args.concat(next_host(n), [
|
||||||
coreos_image_ids[coreos_update_channel], 'core',
|
coreos_image_ids[coreos_update_channel], 'core',
|
||||||
]);
|
]);
|
||||||
@ -249,11 +261,11 @@ exports.destroy_cluster = function (state_file) {
|
|||||||
|
|
||||||
conf.destroying = true;
|
conf.destroying = true;
|
||||||
task_queue = _.map(conf.hosts, function (host) {
|
task_queue = _.map(conf.hosts, function (host) {
|
||||||
return ['vm', 'delete', '--quiet', '--blob-delete', host.name];
|
return ['vm', 'delete', '--quiet', '--blob-delete', host.name, get_subscription()];
|
||||||
});
|
});
|
||||||
|
|
||||||
task_queue.push(['network', 'vnet', 'delete', '--quiet', conf.resources['vnet']]);
|
task_queue.push(['network', 'vnet', 'delete', '--quiet', conf.resources['vnet'], get_subscription()]);
|
||||||
task_queue.push(['storage', 'account', 'delete', '--quiet', conf.resources['storage_account']]);
|
task_queue.push(['storage', 'account', 'delete', '--quiet', conf.resources['storage_account'], get_subscription()]);
|
||||||
|
|
||||||
exports.run_task_queue();
|
exports.run_task_queue();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user