I. When deploying the Kubernetes cluster, we used Acs-engine to generate 3 JSON files and some certificate files, as follows:
- Apimodel.json-Cluster configuration file
- Azuredeploy.json-Core Arm (Azure Resource Model) template for deploying k8s clusters
- Azuredeploy.parameters.json-Deployment parameters file, where parameters can be customized
- Certificate and Access config Files-kubernetes some of the certificates that are required, and the Kube config profiles it relies on are also stored under the arm template sibling directory
It is important to note that when you modify an existing Docker container cluster, you should modify the Apimodel.json file to ensure that the latest deployment does not affect the resources that are already present in the cluster. For example, if the number of nodes in a container cluster is insufficient, you can modify the number of cluster nodes in the Apimodel.json, and then rerun the Acs-engine command and use Apimodel.json as the input parameter to generate a new arm template. After this deployment, the old nodes in the cluster will not change, and the new nodes will automatically join. Only node node expansion is currently supported.
Two. Modify the number of node nodes in the Apimodel.json and use the Apimodel.json file as the input file to generate a new template.
{ "apiversion": "Vlabs", "location": "Chinaeast", "Properties": { "Orchestratorprofile": { ..... }, "Masterprofile": { "Count": 3, }, "Agentpoolprofiles": [ { "name": " Testagpool1 ", " Count ": 4, #修改node节点数量, expansion to 4 node nodes }}
Three. Modify the newly generated Azuredeploy.json and Azuredeploy.parameters.json files to add offset information.
In the newly generated template file and in the parameter file, you need to modify and add the number of the node's offset, indicating the number of node nodes that existed before the expansion, so that the expansion does not modify the virtual machine that already has the offset number, and creates a new VM from the offset location.
If you find the following error in the expansion, it should be the number of offset not properly configured:
{" error": { "code": "Propertychangenotallowed", "target": "CustomData", "message": "Changing Property ' CustomData ' was not allowed. "}
Modify the offset number of node nodes in Azuredeploy.json, for example, if there are 2 node nodes before expansion, then offset is 2:
"Testagpool1offset": { "allowedvalues": [ 0, ... . " DefaultValue": 2, "metadata": { "description": "The offset into the agent pool where to S Tart creating agents. This value can is from 0 to a, but must is less than Agentcount " }, " type ":" Int " }
Add the node offset information to the Azuredeploy.parameters.json:
"Testagpool1offset": { "value": 2}
Four. Remove the network interface associations in the network security group.
When deploying Kubernetes, Acs-engine built a network security group and associated the NIC for master and all node nodes. During the scaling process, the script removes all other ports in the network security group except for the default port 22/443, so you need to disassociate the NICs in the network security group before you perform the capacity expansion command, otherwise the service will not be accessible externally during the expansion process. If your service does not require external access, you can do so without doing so.
Five. Execute the capacity expansion instruction to realize node expansion.
Azure CLI2:
$ az Cloud set-n azurechinacloud$ az login$ az account set--subscription "<SUBSCRIPTIONNAME OR ID>"$ AZ Group Create--name"<Resource_group_name>"--location"< Location>"$ AZ Group Deployment Create--name"<DEPLOYMENTNAME>"--resource-group"<Resource_group_name>"--template-file"./_output/<INSTANCE>/azuredeploy.json "--parameters"./_output/<INSTANCE>/azuredeploy.parameters.json "
Using Acs-engine to expand an azure kubernetes cluster