# Prepare an offline installation of Cloud Service Mesh

This page explains how to prepare offline installations of Cloud Service Mesh on
[supported platforms](https://docs.cloud.google.com/service-mesh/docs/supported-platforms.md.txt) other than
GKE on Google Cloud.

> [!NOTE]
> **Note:** This guide only supports Cloud Service Mesh with Istio APIs and does not support Google Cloud APIs. For more information see, [Cloud Service Mesh overview](https://docs.cloud.google.com/service-mesh/docs/overview.md.txt).

When you use the `asmcli` tool to
[install Cloud Service Mesh](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/install-in-cluster-cloud-service-mesh.md.txt),
the tool uses a local directory to store configuration and artifacts. By
default, the tool creates a temporary directory when it runs, or you can specify
an existing directory by using the `--output_dir` option on the command line. If
the specified directory already contains the necessary configuration and
artifacts, the tool re-uses those instead of re-downloading them.

Offline installation uses this behavior so that you can install
Cloud Service Mesh on machines without internet access. You first run the
`asmcli build-offline-package` subcommand on a machine with internet access to
populate an output directory with the required configuration package, and then
copy that directory to the offline machines for installation.

## Before you begin

Before you begin, make sure that you:

- Review [the prerequisites](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/cloud-service-mesh-prerequisites.md.txt).

- Review the information in
  [Plan the install](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/plan-install.md.txt).

- [Install the required tools](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/install-dependent-tools.md.txt#install_required_tools).

- [Download `asmcli`](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/install-dependent-tools.md.txt#download_asmcli).

- During installation, ensure access to
  [Google APIs and Services](https://docs.cloud.google.com/vpc/docs/configure-private-google-access-hybrid.md.txt)
  is possible, or manually enable the required dependencies. Even in offline
  mode, `asmcli` uses Google Cloud CLI to enable some dependencies if the
  corresponding flag is passed during installation.

> [!NOTE]
> **Note:** The core installation manifests for `canonical-service-controller` require pulling the `kube-rbac-proxy` image from Docker Hub (`docker.io`). In restricted or air-gapped environments, configure a registry mirror at the cluster or containerd level, such as a private Harbor registry, to resolve this image dependency without opening outbound firewall egress to the public internet. For more information about configuring a registry mirror in Google Distributed Cloud environments, see [Use a registry mirror for container images](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/registry-mirror.md.txt).

## Offline installation of Cloud Service Mesh

The following outlines how to prepare an offline installation of Cloud Service Mesh:

1. On the machine with internet access that you installed Cloud Service Mesh,
   create a package and then save it to the folder
   <var translate="no">OFFLINE_PKG_DIR_PATH</var>:

       ./asmcli build-offline-package \
       --output_dir OFFLINE_PKG_DIR_PATH

   > [!NOTE]
   > **Note:** The `offline-package` includes critical hidden files. You must copy all of the files to the offline machine. To avoid missing files, create an archive bundle of the entire `output_dir` and copy it to the offline machine.

2. Copy the configuration directory and `asmcli` tool to the offline machine.

3. Follow the instructions for
   [installing Cloud Service Mesh](https://docs.cloud.google.com/service-mesh/docs/onboarding/kubernetes-off-gcp/install/install-in-cluster-cloud-service-mesh.md.txt).
   Wherever the instructions specify to run `asmcli install`, ensure that you
   also pass the `--offline` flag and specify the configuration directory
   created in the previous steps:

         ./asmcli install \
         --output_dir OFFLINE_PKG_DIR_PATH \
         --project_id PROJECT_ID \
         --cluster_location CLUSTER_LOCATION \
         --cluster_name CLUSTER_NAME \
         --offline

## What's next?

- Learn about [setting up a multi-cluster mesh outside of Google Cloud](https://docs.cloud.google.com/service-mesh/docs/operate-and-maintain/off-gcp-multi-cluster-setup.md.txt).

- [Configure an external IP address on-premises](https://docs.cloud.google.com/service-mesh/docs/operate-and-maintain/external-ip-load-balance.md.txt).

- [Deploy the Online Boutique sample application](https://docs.cloud.google.com/service-mesh/docs/onlineboutique-install-kpt.md.txt).