3
govc is a vSphere CLI built on top of govmomi.
7
You can find prebuilt govc binaries on the [releases page](https://github.com/vmware/govmomi/releases).
9
Download and install a binary locally like this:
12
curl $URL_TO_BINARY | gzip -d > /usr/local/bin/govc
13
chmod +x /usr/local/bin/govc
18
You can install the latest govc version from source if you have the Go toolchain installed.
21
go get github.com/vmware/govmomi/govc
24
(make sure `$GOPATH/bin` is in your `PATH`)
28
govc exposes its functionality through subcommands. Option flags
29
to these subcommands are often shared.
33
* `-u`: ESXi or vCenter URL (ex: `user:pass@host`)
34
* `-debug`: Trace requests and responses (to `~/.govmomi/debug`)
36
Managed entities can be referred to by their absolute path or by their relative
37
path. For example, when specifying a datastore to use for a subcommand, you can
38
either specify it as `/mydatacenter/datastore/mydatastore`, or as
39
`mydatastore`. If you're not sure about the name of the datastore, or even the
40
full path to the datastore, you can specify a pattern to match. Both
41
`/*center/*/my*` (absolute) and `my*store` (relative) will resolve to the same
42
datastore, given there are no other datastores that match those globs.
44
The relative path in this example can only be used if the command can
45
umambigously resolve a datacenter to use as origin for the query. If no
46
datacenter is specified, govc defaults to the only datacenter, if there is only
47
one. The datacenter itself can be specified as a pattern as well, enabling the
48
following arguments: `-dc='my*' -ds='*store'`. The datastore pattern is looked
49
up and matched relative to the datacenter which itself is specified as a
52
Besides specifying managed entities as arguments, they can also be specified
53
using environment variables. The following environment variables are used by govc
56
* `GOVC_URL`: URL of ESXi or vCenter instance to connect to.
58
> The URL scheme defaults to `https` and the URL path defaults to `/sdk`.
59
> This means that specifying `user:pass@host` is equivalent to
60
> `https://user:pass@host/sdk`.
62
* `GOVC_INSECURE`: Allow establishing insecure connections.
64
> Use this option when the host you're connecting is using self-signed
65
> certificates, or is otherwise trusted. Set this option to `1` to enable.
73
* `GOVC_RESOURCE_POOL`
77
* `GOVC_GUEST_LOGIN`: Guest credentials for guest operations
81
* [Upload ssh public key to a VM](examples/lib/ssh.sh)
83
* [Create and configure a vCenter VM](examples/vcsa.sh)
85
## Projects using govc
87
* [Kubernetes vSphere Provider](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/cluster/vsphere)
91
govc is available under the [Apache 2 license](../LICENSE).