You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add a troubleshooting section and a table of contents (#175)
The README documents every option well, but says nothing about what to do
when a run fails. The failures that cost the most time are the ones where
the driver's message is accurate and still unhelpful without knowing GCE:
"Image family ubuntu-2204-lts is not valid" almost always means a missing
image_project rather than a wrong family name, and a create that hangs at
"Waiting for server to be ready" has three quite different causes.
Covers the validation errors the driver raises by name, the two that come
back from GCE instead (quota and disk type), the hang, the two Windows
failures, and how to find instances and disks left behind by a Ctrl-C -
which the driver's own cleanup cannot handle, because Interrupt is not a
StandardError.
Also adds a table of contents. The page is long enough now that the
Configuration tables are hard to find from the top.
Signed-off-by: Tim Smith <tim@mondoo.com>
Copy file name to clipboardExpand all lines: README.md
+139Lines changed: 139 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,19 @@ Compared to other IaaS providers, GCE offers fast instance launch times and sub-
9
9
10
10
> This documentation uses [Cinc Workstation](https://cinc.sh/) and the `cinc` commands throughout. Everything here works identically with Chef Workstation — see [Using with Chef](#using-with-chef).
11
11
12
+
## Contents
13
+
14
+
-[Requirements](#requirements)
15
+
-[Installation](#installation)
16
+
-[Authentication](#authentication)
17
+
-[Quick Start](#quick-start)
18
+
-[Configuration](#configuration)
19
+
-[Examples](#examples)
20
+
-[Troubleshooting](#troubleshooting)
21
+
-[Using with Chef](#using-with-chef)
22
+
-[Contributing](#contributing)
23
+
-[License](#license)
24
+
12
25
## Requirements
13
26
14
27
- Ruby 3.1 or later (already satisfied if you use Cinc Workstation)
@@ -433,6 +446,132 @@ driver:
433
446
count: 1
434
447
```
435
448
449
+
## Troubleshooting
450
+
451
+
Almost every failure below is reported by the driver before it creates
452
+
anything, so nothing is billing while you work out what is wrong.
453
+
454
+
**`Project my-project is not a valid project`.** Usually credentials rather
455
+
than the project name: the driver cannot see a project it is not authorised
456
+
for, and reports that the same way as one that does not exist. Check with
457
+
`gcloud auth application-default print-access-token`, then confirm the Compute
**Quota errors on create.** `Quota 'CPUS' exceeded` and friends come back from
513
+
GCE, not from the driver. Quotas are per-region: check
514
+
`gcloud compute regions describe us-central1`, and remember that a failed run
515
+
that was interrupted may still be holding instances.
516
+
517
+
**`kitchen create` hangs at "Waiting for server to be ready".** The instance is
518
+
running and the transport cannot reach it. In order of likelihood:
519
+
520
+
- **A firewall rule.** The default VPC allows SSH and RDP but not WinRM. Add a
521
+
rule for TCP 5985 and tag the instances — see [Windows](#windows).
522
+
- **`use_private_ip: true` from outside the network.** There is no route to the
523
+
internal address unless you are on the VPC or behind a VPN.
524
+
- **OS Login.** If the project or the instance enforces it, keys published as
525
+
`ssh-keys`metadata are ignored. Either grant the account
526
+
`roles/compute.osLogin`and let `gcloud compute ssh` provision it, or set
527
+
`enable-oslogin: "FALSE"` in the instance `metadata`.
528
+
529
+
The wait itself belongs to the transport, not to `wait_time` — see
530
+
[Timing](#timing). Lowering `max_wait_until_ready` turns a ten-minute hang into
531
+
a two-minute failure while you work out which of the three it is.
532
+
533
+
**`WinRM::WinRMAuthorizationError` on a Windows platform.** The transport is
534
+
connecting as `Administrator`, which Google's images ship disabled. The guest
535
+
agent resets its password without enabling it, so the login is refused. Set
536
+
`transport.username`to anything else and the agent creates that account
537
+
instead. The driver warns about this before it creates the instance.
538
+
539
+
**`Timed out after 120 seconds waiting for the GCE agent to reset the
540
+
password`.** The in-guest agent never answered on the serial port. Windows
541
+
images take several minutes to first boot, so raise `winpass_timeout`. If it
542
+
still times out, the image probably has no guest agent — use one from
543
+
`windows-cloud`rather than a custom image built without it.
544
+
545
+
**`Request did not complete in 600 seconds`.** A GCE operation did not finish
546
+
within `wait_time`. The operation is still running on Google's side, so look at
547
+
the instance in the Cloud Console before retrying.
548
+
549
+
**Instances or disks left behind after an interrupted run.** `Ctrl-C` raises
550
+
`Interrupt`, which is not a `StandardError`, so the driver's own cleanup does
551
+
not run. It records what it created in the state file first, precisely so that
552
+
a follow-up `kitchen destroy` can find it:
553
+
554
+
```sh
555
+
cinc kitchen destroy
556
+
```
557
+
558
+
If the state file is gone too, the driver stamps `created-by: test-kitchen`
559
+
into every instance's metadata, so they can be found and removed by hand:
560
+
561
+
```sh
562
+
gcloud compute instances list --filter="metadata.items.key=created-by AND metadata.items.value=test-kitchen"
563
+
gcloud compute disks list --filter="-users:*"
564
+
```
565
+
566
+
**Anything else.** Run with `-l debug`:
567
+
568
+
```sh
569
+
cinc kitchen create default-ubuntu-2204 -l debug
570
+
```
571
+
572
+
The debug log records every API call the driver makes and the error the Google
573
+
client returned, which is usually enough to see what GCE actually objected to.
574
+
436
575
## Using with Chef
437
576
438
577
This driver is not tied to Cinc. The examples above use Cinc Workstation and the `cinc_infra` provisioner, but the driver works exactly the same with [Chef Workstation](https://www.chef.io/downloads/tools/workstation) — run `kitchen` instead of `cinc kitchen`, and use `chef_infra` instead of `cinc_infra`:
0 commit comments