Hi,
I created an instance-template that uses image-family attribute and verified that it has expected configuration via `gcloud beta compute instance-templates describe udev` sub-command:
kind: compute#instanceTemplate
name: udev
properties:
canIpForward: false
disks:
- autoDelete: true
boot: true
deviceName: udev
index: 0
initializeParams:
diskSizeGb: '20'
diskType: pd-balanced
sourceImage: https://compute.googleapis.com/compute/beta/projects/proj-network-comm-1/global/images/family/ubuntu-dev
kind: compute#attachedDisk
mode: READ_WRITE
type: PERSISTENT
machineType: n1-standard-1
.....
However, when I launch the instance via the template from the console, it totally ignores this setting and launches Debian image instead. Did anyone encounter this problem?
As the disk capacity and type are correct, I suspect an issue with the custom image `ubuntu-dev`.
I recommend to use Cloud Shell to deploy your VM from the instance template [1] which will may provide valuable information by adding the flag `--verbosity=debug` at the end:
gcloud compute instances create [INSTANCE_NAME] --source-instance-template [INSTANCE_TEMPLATE_NAME] --verbosity=debug
Off the top of my head, that seems to have an issue with the sourceImage path.
Usually the sourceImage path look like:
default image:
sourceImage: projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20211103
or
custom image:
sourceImage: projects/<PROJECT_ID>/global/images/<CUSTOM_IMAGE_NAME>
As test, you can use Google Console to create your instance template by choosing your custom image and when completed, instead clicking on `Create` click on `REST` to get your sourceImage path from the json file.
It's also worth to verify if you have access to the custom image, you can review this documentation to share custom images within an organization [2]
I hope that will help.
[1]
Hi @BrunoA , ubuntu-dev is image family and before posting the question I verified that all the settings are correct and it's usable via gcloud cli.
I was probably unclear. There is a bug in Google console that rejects instance templates that use image families settings. As a result of this bug, it's impossible to launch instances via such template in Google console.
I would expect that most production teams would use image families settings instead of specific images since this simplifies production maintenance. Which means that for most teams, instance templates can not be used via google cloud console. Now, if I remember correctly, image families exist in GCP at least since 2017. It means this bug exists in Google cloud console at least for the last 4 years.
I am constantly working with AWS cloud and Google Cloud and I must say, I can not imagine that such basic bug for such basic feature would exists in AWS console for 4 years without AWS folks fixing it. So, please, @BrunoA since you are Google employee and I am Google Cloud paying customer, please:
1. Confirm the existence of bug
2. Open an issue in your systems
3. Thank me for reporting it.
Hello @roman21 ~ I will be pleased to report any issue with GCP as long as I can reproduce it. However, I used the public family image `centos-7` to deploy a VM instance and everything works as expected. I then created a `custom-family-image` based on the VM that I created previously and once again, I deployed the latest centos-7-v20211105`. As `Debian-10` is the default image, I suspect a misconfiguration in your image family creation.
Here are my steps:
1. I created a VM from the public `Centos-7` family image [1]:
gcloud compute instance create family-image-vm --image-family=centos-7 --image-project=centos-cloud
2. The VM have been created properly and the image installed on the disk is `centos-7-v20211105 `
3. I detached the disk from that VM instance and created my custom family image [2]:
gcloud compute images create my-custom-image-family --source-disk family-image-disk --source-disk-zone us-central1-b --family custom-family
4. Once my new `custom-image-family` have been created, I deployed a new VM instance from that custom family image:
gcloud compute instances create family-image-vm --image-family=custom-family --image-project=my_project_id
5. The VM have been deployed as intended with my own custom image family.
[1] https://cloud.google.com/compute/docs/instances/create-start-instance#publicimage
[2] https://cloud.google.com/compute/docs/images/image-families-best-practices#custom-families
Hi Bruno, thank you for the reply. I meant it does not work from UI console.
It does work with cli. So if I create an instance template via cli that uses image family (as opposed to a specific image) like this:
gcloud beta compute instance-templates create udev --machine-type=n1-standard-1
--network=... --network-tier=PREMIUM --no-restart-on-failure
--maintenance-policy=TERMINATE --image-family=ubuntu-dev
--boot-disk-size=20GB --boot-disk-type=pd-balanced --boot-disk-device-name=udev
and then will try to use it via UI console by launching a vm via instance template "udev", it won't use image family ubuntu-dev but will use Debian image instead. I suspect it's because image family support has never been integrated into UI console.