Google Cloud SDK for ARM architecture
Asked Answered
P

4

6

I would like to work Google Cloud SDK on ARM machine.

$ uname -a
Linux myhost 3.14.79-at10 #2 SMP PREEMPT Mon Mar 6 15:38:30 JST 2017 armv7l GNU/Linux

In this page, I can find only for x86 architecture.

Can I work Google Cloud SDK on ARM?

Panelist answered 14/4, 2017 at 10:9 Comment(0)
H
2

The answer is No. The SDK is closed source, and it's very not likely that you can hack it to work on ARM. I won't stop you from doing that since it mostly consists of Python scripts.

On the other hand, gsutil, a part of the SDK which handles Cloud Storage operations, is open source and on PyPI. You can install that using pip just as normal.

Haas answered 14/4, 2017 at 10:22 Comment(1)
The SDK I downloaded is not closed-source, so either we are referring to different SDKs or the license has been changed. I downloaded google-cloud-sdk-292.0.0-linux-x86_64.tar.gz from their "Quickstart for Linux" page and it has a LICENSE file saying Apache 2.0. The only precompiled x86-64 binaries are bin/anthoscli (irrelevant if you're not using Anthos), and lib/third_party/grpc/_cython/cygrpc.so (irrelevant if you're not using gRPC). On a Raspberry Pi I used gcloud init --console-only and gcloud app deploy app.yaml, workedMohican
A
6

Yes - I was able to install it using the apt-get instructions on an ARM64 (aarch64) Pinebook Pro. If you don't have Ubuntu/Debian, you could use a Docker container. I did it from Manjaro-ARM using an Ubuntu container.

I would think those instructions would work for a Raspberry Pi running Raspbian.

Although the link above, being maintained by Google, may be the best place to obtain these instructions, I will copy in the current minimal set of commands below, just in case the instructions get moved at some point:

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init

You could optionally install any of the following additional packages:

  • google-cloud-sdk-app-engine-python
  • google-cloud-sdk-app-engine-python-extras
  • google-cloud-sdk-app-engine-java
  • google-cloud-sdk-app-engine-go
  • google-cloud-sdk-bigtable-emulator
  • google-cloud-sdk-cbt
  • google-cloud-sdk-cloud-build-local
  • google-cloud-sdk-datalab
  • google-cloud-sdk-datastore-emulator
  • google-cloud-sdk-firestore-emulator
  • google-cloud-sdk-pubsub-emulator
  • kubectl
Assizes answered 3/6, 2020 at 21:48 Comment(0)
H
2

The answer is No. The SDK is closed source, and it's very not likely that you can hack it to work on ARM. I won't stop you from doing that since it mostly consists of Python scripts.

On the other hand, gsutil, a part of the SDK which handles Cloud Storage operations, is open source and on PyPI. You can install that using pip just as normal.

Haas answered 14/4, 2017 at 10:22 Comment(1)
The SDK I downloaded is not closed-source, so either we are referring to different SDKs or the license has been changed. I downloaded google-cloud-sdk-292.0.0-linux-x86_64.tar.gz from their "Quickstart for Linux" page and it has a LICENSE file saying Apache 2.0. The only precompiled x86-64 binaries are bin/anthoscli (irrelevant if you're not using Anthos), and lib/third_party/grpc/_cython/cygrpc.so (irrelevant if you're not using gRPC). On a Raspberry Pi I used gcloud init --console-only and gcloud app deploy app.yaml, workedMohican
S
1

We organize our local environments around Docker. Unfortunately, there is no official ARM Docker image for the Google Cloud SDK. To get around that, we cloned the official Google Cloud SDK Dockerfile and, after some trial and error, were able to remove the unavailable SDK modules so we can build locally to produce an ARM Docker image. The unavailable modules were not an issue for us as we don't use them so we just commented them out (see the LOCAL_HACK section below). Here is the current hacked Dockerfile we use:

# This is a temporary workaround Dockerfile to allow us to run the Google SDK on Apple Silicon
# For the original @see https://raw.githubusercontent.com/GoogleCloudPlatform/cloud-sdk-docker/master/Dockerfile

FROM docker:19.03.11 as static-docker-source

FROM debian:buster
ARG CLOUD_SDK_VERSION=365.0.1
ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION
ENV PATH "$PATH:/opt/google-cloud-sdk/bin/"
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
RUN groupadd -r -g 1000 cloudsdk && \
    useradd -r -u 1000 -m -s /bin/bash -g cloudsdk cloudsdk
RUN apt-get -qqy update && apt-get install -qqy \
        curl \
        python3-dev \
        python3-crcmod \
        python-crcmod \
        apt-transport-https \
        lsb-release \
        openssh-client \
        git \
        make \
        gnupg && \
    export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
    echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list && \
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
    apt-get update && \
    apt-get install -y google-cloud-sdk=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-app-engine-python=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-app-engine-python-extras=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-app-engine-java=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-datalab=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-datastore-emulator=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-pubsub-emulator=${CLOUD_SDK_VERSION}-0 \
        google-cloud-sdk-firestore-emulator=${CLOUD_SDK_VERSION}-0 \
        kubectl && \
    gcloud --version && \
    docker --version && kubectl version --client

# >>> LOCAL HACK START
# @todo Removed the following packages from the `apt-get install` above as we cannot build them locally
#8 29.36 E: Unable to locate package google-cloud-sdk-app-engine-go
#8 29.37 E: Version '339.0.0-0' for 'google-cloud-sdk-bigtable-emulator' was not found
#8 29.37 E: Unable to locate package google-cloud-sdk-spanner-emulator
#8 29.37 E: Unable to locate package google-cloud-sdk-cbt
#8 29.37 E: Unable to locate package google-cloud-sdk-kpt
#8 29.37 E: Unable to locate package google-cloud-sdk-local-extract
#        google-cloud-sdk-app-engine-go=${CLOUD_SDK_VERSION}-0 \
#        google-cloud-sdk-bigtable-emulator=${CLOUD_SDK_VERSION}-0 \
#        google-cloud-sdk-spanner-emulator=${CLOUD_SDK_VERSION}-0 \
#        google-cloud-sdk-cbt=${CLOUD_SDK_VERSION}-0 \
#        google-cloud-sdk-kpt=${CLOUD_SDK_VERSION}-0 \
#        google-cloud-sdk-local-extract=${CLOUD_SDK_VERSION}-0 \
# <<< LOCAL HACK END

RUN apt-get install -qqy \
        gcc \
        python3-pip
RUN pip3 install --upgrade pip
RUN pip3 install pyopenssl
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
VOLUME ["/root/.config", "/root/.kube"]

If you were to save this file as Dockerfile.CloudSdk.arm64, you can then run a docker build on an ARM machine (in our case, an Apple M1 machine) to produce your ARM Docker image:

docker build -f Dockerfile.CloudSdk.arm64 -t yourorg.com/cloud-sdk-docker-arm:latest .

Voila! You now have a reasonably featured Google Cloud SDK Docker image that will run beautifully on an ARM architecture :)

Sulfuric answered 13/1, 2022 at 9:57 Comment(1)
The are now official multi-arch images available on GCR: gcr.io/google.com/cloudsdktool/cloud-sdk. Note that the DockerHub images (google/cloud-sdk) are not multi-arch images for backwards compatibility sake: github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/…Educatory
L
0

If you have python or python3, along with pip and pip3, try:

pip install --upgrade google-cloud

Hope that helps.

tekk@rack:~ $ uname -a
Linux rack 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux

It worked for me.

Laure answered 21/11, 2017 at 21:47 Comment(2)
This answer is now outdated I'm sorry to say. The google-cloud PyPI page says "WARNING: The google-cloud Python package is deprecated. On June 18, 2018, this package will no longer install any other packages. Please install the product-specific google-cloud-* packages needed for your application."Mohican
Also the gcloud command does not seem to be provided by any of the google-cloud-* pip packages.Mohican

© 2022 - 2024 — McMap. All rights reserved.