Google Cloud Run

Getting started with Akita is as simple as dropping our Agent into your Dockerfile. Below are instructions for installing the Akita Agent in Google Cloud Run using a Dockerfile.


Linux Support Only

We only support Linux at the moment. If you're running Google Cloud Run with Windows, you can try DIY Akita Agent Integration


Deploying directly from source?

If you are using Google Cloud Run to deploy an application without a container, these instructions do not apply to you. See DIY Akita Agent for a possible alternative.


Akita requires execution environment gen2

The current GA release of Google Cloud Run uses a runtime environment which simulates Linux system calls. This simulated environment cannot support the Akita client's passive observation. You will need to upgrade your execution environment to "gen2", which supports full Linux compatibility. This is a beta feature in Google Cloud; see About Execution Environments in the Google Cloud Run documentation.

You will be setting up the Akita Agent to run within your Docker container. To set up the Akita Agent you will:

  1. Create an Akita Project
  2. Generate an API key for the Akita Agent
  3. Install the Akita Agent in your container
  4. Run the Akita Agent
  5. Configure your Akita API key as a Secret
  6. Launch the new container
  7. Verify that the Akita Agent is working


Akita Account Required

You must have an Akita account to use Akita. You can create an account here.

Create a project

Log into the Akita App, and go to the Settings page.
Enter a project name and click "Create Project". We suggest naming the project after your app or deployment stack.

Give your project a name that's easy to remember – you'll need it later, when you start the Akita Agent on the CLI.

Generate API key

On the same Settings page, locate and click the “API Keys” tab. Click the “Set up the Akita client” button. Copy your API key secret into your favorite password manager or somewhere else you can easily access it. Also note your API key, as you will need it later.

Install Agent in container

Install the Akita Agent during your container build process by running the install script below, adding it to your Dockerfile.

RUN bash -c "$(curl -L"

Run Agent

There are two options for running the Akita Agent:

  1. Modify the entry point in your Dockerfile, or
  2. Via a script

Run with Dockerfile

Next, change your container's default command to the Akita Agent by adding the below to your Dockerfile. Use the project name you created earlier on the Akita console.
You will need to set a rate-limit. We recommend starting with a low rate-limit, as it is applied to each running container.

CMD ["/usr/local/bin/akita", "apidump", "--project", "<your project name>", \
     "-u", "root", "-c", "<your normal command line>", \
     "--rate-limit", "1000"]

Run with script

If your normal entry point is a script, you can run the Akita Agent as a background process. Run akita apidump --project <your_project_name> in the background.

Configure API key

The Akita Agent needs to access the API Key you created earlier; the simplest way is to set is as an environment variable in the Cloud Run service. In the UI, you can specify environment variables while creating or deploying a new revision of your service:

Or, you can specify the API key ID and API key secret on the command line with the --set-env-vars flag when you deploy a new version of the service.

$ gcloud beta run deploy ... \ 
  --set-env-vars AKITA_API_KEY_ID=apk_xxxx,AKITA_API_KEY_SECRET=xxxxxxxxxxxx

Launch Container

After editing your Dockerfile and rebuilding, you need to launch the new version of service in a gen2 execution environment. On the command line, you can specify this as a command line flag:

$ gcloud beta run deploy ... \
  --execution-environment gen2 \
  --set-env-vars AKITA_API_KEY_ID=apk_xxxx,AKITA_API_KEY_SECRET=xxxxxxxxxxxx

Note that you have to specify beta to enable the gen2 execution environment, as it is not currently a GA release.

From the console, you can select the "Second generation" execution environment.


In the Akita web console, check out the incoming data on the Model page. You should see a map of your API being generated as the Akita Agent gathers data.

Then check out the Metrics and Errors page to get real-time information on the health of your app or service.