I am trying to create multiple VMs in the same cloud service (but in unique deployments within the cloud service). The below produces only one machine which will have the name mycluster-master-3 (given self.numMasters == 3). In other words, only the last machine is actually created and can be seen in Azure management portal. Note that there are no errors when I execute this code with self.numMasters == 3:
for node in range(self.numMasters):
logger.info('Deploying virtual machine "%s"...' % (self.clusterName + '-master-' + str(node + 1)))
logger.info('Creating linuxConfig...')
linuxConfig = azure.servicemanagement.LinuxConfigurationSet(
host_name=self.clusterName + '-master-' + str(node + 1),
user_name='auser',
user_password='Auser123!',
disable_ssh_password_authentication=True
)
# Destination storage account container/blob where the VM disk
# will be created
media_link = 'https://xxxxxxx.blob.core.windows.net/xxxxxx/%s.vhd' % (self.clusterName + '-master-' + str(node + 1))
os_hd = azure.servicemanagement.OSVirtualHardDisk(image_name, media_link)
logger.info('Creating virtual machine deployment...')
self.sms.create_virtual_machine_deployment(
service_name=serviceName,
deployment_name=self.clusterName + '-master-' + str(node + 1),
label=self.clusterName + '-master-' + str(node + 1),
role_name=self.clusterName + '-master-' + str(node + 1),
system_config=linuxConfig,
os_virtual_hard_disk=os_hd,
role_size=self.instanceType,
deployment_slot='production'
)
I thought having all my VMs in one cloud service would allow them to talk to each other internally without being exposed to machines in my other cloud services. But apparently, a cloud service provides a single public IP to VM within it. Perhaps that's why only one VM is created, although, conceptually, I thought a single cloud service can have multiple VM instances. This confuses the hell out of me. So now I am thinking that I need to have one cloud service for each VM instance in my cluster. This way, all of the machines will have a public IP and can be accessed over the internet. I also need to put all the cloud services within a virtual network. That way, traffic between them will not be routed through internet. Is my assumption correct? Is there a better/other way to accomplish what I want (a cluster of machines talking to each other securely and fast, yet be SSH-able through internet.)