Skip to main content
NetApp Solutions

Deploy an application from the Google Cloud Console Marketplace

Contributors kevin-hoke

This section details how to deploy an application to your Anthos GKE cluster on prem, using the Google Cloud Console.

Prerequisites

  • An Anthos cluster deployed on premises and registered with Google Cloud Console

  • A MetalLB load balancer configured in your Anthos cluster

  • An account with permissions to deploy applications to the cluster

  • A billing account with Google Cloud if you choose an application with associated costs (optional)

Deploying an application

For this use case, we deploy a simple WordPress application to one of our Anthos clusters using the Google Cloud Console. The deployment uses persistent storage provided by NetApp ONTAP in a predefined storageclass. We then demonstrate two different methods to modify the applications default service so that the MetalLB load balancer supplies it with an IP address and exposes it to the world.

To deploy an application in this manner, complete the following steps:

  1. Verify that the cluster you want to deploy to is accessible in Google Cloud Console.

    Registered Clusters

  2. Select Applications from the left-side menu, select the three-dot option menu at the top, and select Deploy from Marketplace, which brings up a new window from which you can select an application from the Google Cloud Marketplace.

    Application Marketplace

  3. Search for the application you want to install, in this case WordPress.

    Search For WordPress

  4. After you select the WordPress application, an overview screen displays. Click the Configure button.

    WordPress Overview Screen

  5. On the next page you must select the cluster to deploy to, in our case Demo-Cluster. Select or create a new namespace and application instance name, and select which storage classes and persistent volume sizes you need for both the WordPress application and its backing MariaDB database. In both cases, we chose the ONTAP-NAS-CSI storage class.

    WordPress Configuration

    Note Do not select Enable public IP Access. Doing so creates a service of type NodePort that is not accessible from an on-premises Anthos deployment.
  6. After you click the Deploy button, you get a page providing application details. You can refresh this page or log into your cluster using the CLI to check the status of the deployment.

    Application Details

  7. The CLI can be used to check the status of the application as it is being deployed by running the command to fetch pod info in our application namespace: kubectl get pods -n anthos-wp.

    Kubectl get pods

    Note Notice in this screenshot that there is a deployer pod in an error state. This is normal. This pod is a helper pod used by the Google Cloud Console to deploy the application that self-terminates after the other pods have begun their initialization process.
  8. After a few moments, verify that your application is running.

    Application Running

Exposing the application

After the application is deployed, you have two methods to assign it a world-reachable IP.

Using the Google Cloud Console

You can expose the application by using the Google Cloud Console and editing the YAML output for the services in a browser to set a publicly reachable IP. To do so, perform the following steps:

  1. In the Google Cloud Console, click Services and Ingress in the left-side menu.

    Services and Ingress

  2. Click the wordpress-wordpress-svc service. This opens the Service Details screen. Click the Edit button at the top.

    Edit Service Details

  3. The Editing Service Details page opens containing the YAML information for the service. Scroll down until you see the spec: section and the type: value, which is set to ClusterIP. Change this value to LoadBalancer and click the Save button.

    Type ClusterIP Value

    Type LoadBalancer Value

  4. When you return to the Service Details page, the Type: now lists LoadBalancer and the External endpoints: field lists an assigned IP address from the MetalLB pool and the port through which the application is accessible.

    Service Details Final

Patching the service with Kubectl

You can expose the application by using the CLI and the kubectl patch command to modify your deployment and set a publicly reachable IP. To do so, complete the following steps:

  1. List the services associated with the pods in your namespace with the kubectl get services -n anthos-wp command.

    List Services

  2. Modify the service type from ClusterIP to type Loadbalancer using the following command:

    kubectl patch svc wordpress-wordpress-svc -p '{"spec": {"type": "LoadBalancer"}}' -n anthos-wp'.

    This new service type is automatically assigned an available IP address from the MetalLB pool.

    Patch Service To Type LoadBalancer

Visit the application at the exposed external IP

Now that you have the application exposed with a publicly reachable IP address, you can visit your WordPress instance using a browser.

WordPress In Browser