Continuing my education on Photon Controller, I was trying to figure out how I would select a particular VM network (port group) for containers to use when I was deploying a particular framework on top of Photon Controller. Let’s say for instance that I had two VM Networks, one using VLAN 51 and another using VLAN 30. Initially I thought the frameworks would choose the default “VM Network” but quickly realized this was not the case. How then would I select the correct one for my framework?
*** Please note that at the time of writing, Photon Controller is still not GA ***
*** The steps highlighted here may change in the GA version of the product ***
I achieved it via Photon Controller CLI (photon CLI for short), although there may be other ways that I am not yet familiar with. You will need to know the VM network portgroup name before you begin. Below I am creating a network identifier for the portgroup called “VM Network” which is on VLAN 51:
> photon -n network create --name vm-nw --portgroups "VM Network" \ --description "VM Network" a87ea8a0-29c9-461f-a963-8142f2523105
Next, let me create another network identifier, this time on a different port group called “docker” which is on VLAN 30:
> photon -n network create --name con-nw --portgroups "docker" \ --description "Container Network" df11a972-e62b-479e-b5d1-eb040bac68f8
Let’s check the networks we created using the following command:
> photon network list Using target 'http://10.27.51.118:28080' ID Name State PortGroups Descriptions a87ea8a0-29c9-461f-a963-8142f2523105 vm-nw READY [VM Network] VM Network df11a972-e62b-479e-b5d1-eb040bac68f8 con-nw READY [docker] Container Network Total: 2
VmProvisionTaskService failed with error [Task "CREATE_VM": step "RESERVE_RESOURCE" failed with error code "NetworkNotFound", message "Network con-nw not found"].
Here is an example of such a command to deploy a Kubernetes cluster framework (note the -w option which specifies the network, and the fact that it requires the ID and not the name):
> photon cluster create -n k8-cluster -k KUBERNETES --container-network 172.30.0.0/24 \ -w df11a972-e62b-479e-b5d1-eb040bac68f8 --dns 172.30.0.252 --gateway 172.30.0.254 \ --netmask 255.255.255.0 --master-ip 172.30.0.151 --etcd1 172.30.0.152 -s 1 Using target 'http://10.27.51.118:28080'