The Compute Engine container startup agent starts a container deployed on a VM instance using Deploying Containers on VMs and Managed Instance Groups method.
The agent parses container declaration that is stored in VM instance metadata
under gce-container-declaration key and starts the container with the declared
configuration options.
The agent is bundled with Container-Optimized OS image, version 62 or higher.
Container startup agent is deployed as a Docker container and is hosted in Container Registry: gcr.io/gce-containers/konlet.
To build the agent using bazel run these commands from the repository root:
$ pushd gce-containers-startup
$ bazel build :gce-containers-startup
$ popdExport your GCP project name to an environment variable:
$ export MY_PROJECT=your-project-nameTo build a Docker image, copy the build binary to the 'docker' directory and invoke the docker build command:
$ cp gce-containers-startup/bazel-bin/gce-containers-startup docker/
$ docker build docker/ -t gcr.io/$MY_PROJECT/gce-containers-startupTo push resulting Docker image to Google Container Registry you can use gcloud command:
$ gcloud docker -- push gcr.io/$MY_PROJECT/gce-containers-startupIf you would like to install the container startup agent on your VM, copy its systemd service definition and scripts:
-
Copy
systemdservice definitionkonlet-startup.serviceinto systemd services directory, e.g./usr/lib/systemd/system. -
Copy
get_metadata_valuescript to/usr/share/googledirectory. -
Copy
konlet-startupscript to/var/lib/googledirectory
You can also those scripts directly by a startup script,
cloud-init or rc.d scripts.
Compute Engine containe 5744 r startup agent is licensed under Apache License 2.0. The license is available in the LICENSE file.
You can find out more about the Apache License 2.0 at: http://www.apache.org/licenses/LICENSE-2.0.