mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-14 14:20:08 +00:00
Add upload to Google Cloud Storage and Google Compute Image creation
- the image upload uses the cloud API - currently auth and image creation need the `gcloud` CLI tool. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
38
docs/gcp.md
38
docs/gcp.md
@@ -19,41 +19,29 @@ gcloud auth login
|
||||
|
||||
The authentication will redirect to a browser with Google login.
|
||||
|
||||
Also authenticate local applications with
|
||||
```
|
||||
gcloud beta auth application-default login
|
||||
```
|
||||
|
||||
## Build a moby image
|
||||
|
||||
In the `alpine` subdirectory:
|
||||
```shell
|
||||
make gce
|
||||
```
|
||||
or (for a 4.4 kernel):
|
||||
```shell
|
||||
make LTS4.4=1 gce
|
||||
```
|
||||
You'll end up with `gce.img.tar.gz`. It's best to rename it to include the kernel version and the short commit tag or similar before uploading to GCP.
|
||||
Add a `gcp` output line to your yaml config, see the example in `examples/gcp.yaml`.
|
||||
|
||||
If you don't need/want to compile Moby from source, you can do a `make get` in the top-level directory before `make gce`. This downloads most of the build artefacts like the kernel and initrd based on your git hash.
|
||||
Then do `./bin/moby myfile.yaml`
|
||||
|
||||
## Upload an image and create a compute image
|
||||
|
||||
The next step is to upload the image and create a Compute image from it.
|
||||
|
||||
```shell
|
||||
TARBALL=gce.img-4.9-cb44fd1.tar.gz
|
||||
gsutil cp -a public-read ${TARBALL} gs://${NAME}/${TARBALL}
|
||||
# Note, GCP does not like "." in images names
|
||||
gcloud compute images create --source-uri \
|
||||
https://storage.googleapis.com/rolf/${TARBALL} moby-4-9-cb44fd1
|
||||
```
|
||||
This will create a local `myfile.img.tar.gz` compressed image file, upload it to the
|
||||
specified bucket, and create a bootable image.
|
||||
|
||||
## Create an instance and connect to it
|
||||
|
||||
With the image create, we can now create an instance and connect to
|
||||
With the image created, we can now create an instance and connect to
|
||||
the serial port.
|
||||
|
||||
```shell
|
||||
gcloud compute instances create my-node-4-9 \
|
||||
--image="moby-4-9-cb44fd1" --metadata serial-port-enable=true \
|
||||
gcloud compute instances create my-node \
|
||||
--image="myfile" --metadata serial-port-enable=true \
|
||||
--machine-type="g1-small" --boot-disk-size=200
|
||||
|
||||
gcloud compute connect-to-serial-port my-node-4-9
|
||||
gcloud compute connect-to-serial-port my-node
|
||||
```
|
||||
|
Reference in New Issue
Block a user