GKE Cluster

This guide explains how to use the provisioning script provided by OPSWAT to create an GCP GKE and generate all the Kubernetes components needed to run MetaDefender Core.

MetaDefenderK8S script details

  • GitHub Project OPSWAT/metadefender-k8s --> Script path: ./metadefenderk8s.sh

  • Programming Language: Bash

  • Installation Pre-requisites for provisioning:

  • GCP Credentials

    • The Cloud SQL Admin API is enabled. (Optional, enabled when Cloud SQL database is going to be used)

    • Download the credentials for the service account, it should have the following permissions

      • Editor
      • Compute Network Admin
    • Set in your environment variable the path to the JSON key with the credentials for the service account to use

      • GCP_JSON_CREDENTIALS_PATH
  • MetaDefender Core License Key (Required with --mdcore parameter)

    • Set it in your local environment credentials under MDCORE_LICENSE_KEY

How to run script

Only MD Core
MD Core + MDSS
MD Core + ICAP
Copy

The script will deploy a single Worker Node for the cluster with enough space for 1 replica of MD Core. GCP compute size is e2-standard-8 (8 vCPU & 32 GB Memory). Each pod would need a minimum of 4 vCPU and 8 GB Memory. To change the request to adapt each pod to the specific case go to values.yml To change the size of the node pool for having more MD Core replicas or install additional MetaDefender products go to terraform file terraform/gcloud/main.tf

Script Parameters

ParameterFlagsOptionsDefaultDescriptionRequired/Optional
Action
  • provision
  • install
Action to indicate the script if we want to provision (Create resources + install Core) or install (Install Core)Required
Location-l or --location
  • AWS
  • Azure
  • GCP
Where is going to be the K8S clusterRequired
MetaDefender Flag Installation

Combination of

  • --mdcore
  • --mdss
  • --icap
-Install MetaDefender Core in the cluster provisionedRequired
Project ID--project_idGCP project where the resources will be createdRequired
Image Version--imagelatest 5.0.1latestMetaDefender Core image version to installOptional
Region--regionGCP Regionsus-central1AWS region where all the resources will be provisionedOptional
Cluster Name--nameNot uppercase allowedmd-k8sName of the cluster that will be used for naming all the resourcesOptional
Number of Replicas--replicas[0-9]*1Number of replicas for MetaDefender Core serviceOptional
Namespace--namespace[A-Za-z]{1,10}Namespace where MetaDefender products will be installed in the K8S ClusterOptional Max Characters: 10

Connection to Cloud SQL Database from GKE

MetaDefender Core Flowchart Provisioning in GCP

The following flowchart represents how the provisioning script will configure the environment based on the options selected for provisioning GCP GKE.

Summary options to be selected

  1. Access to the K8S cluster. Generate Ingress or provide own access.

    1. An Ingress and an internal load balancer will be created per each product flag added as parameter to the script
    2. Own Access, you decide how to access to the cluster so it won't generate any ingress but will still create the internal load balancer for the product service deployed
  2. Have your own database or create new database

    1. Own database, will be asked if you want the script to set up the credentials and database host url for you or the script will just indicate the secrets to edit, later on by you, for connecting the MetaDefender Core with your database.

    2. Create new DB in K8S or external DB that for GCP we will provision a Cloud SQL Server

      1. If external, indicate how to connect to it, by private connection or SQL Proxy pod

For having GKE of type Autopilot it is needed to change AUTOPILOT_GKE variable to true from terraform.tfvars. Database has to be external (Cloud SQL)

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard