Skip to main content
Version: Next

For GCP Cloud

contents

  1. Edge App GCP CLI Setup
  2. Helm Installation
  3. Download the Edge App Helm Chart
  4. Edge App Installation/Deletion/Update
  5. Use after verification on Edge Conductor  

1. Edge App GCP CLI Setup

  • Edge App GCP infra's resources require a GCP account. Please contact your cloud administrator for a GCP account

  • Pre-installation of gcp-cli, curl, kubectl

        sudo apt-get update
    sudo apt-get install apt-transport-https ca-certificates gnupg curl
    sudo curl -LO https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl
    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  • Install GCP public key

        curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
  • Add the gcloud CLI distribution URI as a package source

        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
  • Update and install the gcloud CLI

        sudo apt-get update
    sudo apt-get install google-cloud-cli
  • Install the gke-gcloud-auth-plugin for GKE access

        gcloud components install gke-gcloud-auth-plugin
    or
    sudo apt-get install google-cloud-cli-gke-gcloud-auth-plugin

2. Helm Installation

  • helm Installation
    sudo snap install helm --classic

3. Download the Edge App Helm Chart

  • Edge App Helm chart installation

    git clone https://github.com/mellerikat/Edge-App.git
  • Edge App Environment Setup (One-time Initial Configuration)

        helm install init ./setup-pacakge/edgeapp-setup-[--version].tgz-f [namespace_setting_file] -n {namespace}

    (ex)

        helm install init ./setup-pacakge/edgeapp-setup-3.7.0.tgz -f example/aws-setup-for-each-namespace.yaml -n edge-app
  • Select and modify one example file according to your environment, then place it after the -f option

    • example/aws-setup-for-each-namespace.yaml
    • example/gcp-setup-for-each-namespace.yaml
    • example/wsl-setup-for-each-namespace.yaml
  • Files for configuring the environment necessary for Edge App operation, such as PV, RoleBind, etc. (gcp example)

    # gcp-setup-for-each-namespace.yaml
    global:
    is_gcp: True # #In case of GCP environment, set True

    env:
    namespace: gke-edge-app #k8s namespace
    serviceaccount: gke-edge-app #k8s service account

4. Edge App Installation/Deletion/Update

  • Edge App Installation

    helm install [edgeapp name] ./edgeapp-package/edgeapp-manifest-[--version].tgz -f example/aws-edgeapp.yaml -n {namespace}

    (ex)

    helm install edgeapp-1 ./edgeapp-package/edgeapp-manifest-3.7.0.tgz -f example/gcp-edgeapp-1.yaml -n gke-edge-app
    helm install edgeapp-2 ./edgeapp-package/edgeapp-manifest-3.7.0.tgz -f example/gcp-edgeapp-2.yaml -n gke-edge-app
    • Select and modify one example file according to your environment, then include it after the -f option

      • example/aws-edgeapp.yaml
      • example/gcp-edgeapp.yaml
      • example/wsl-edgeapp.yaml
    • A file that stores the user/infrastructure information of Edge App

    # example/gcp-edgeapp.yaml
    env:
    type: gcp # Installation environment
    cluster: edgeapp-cluster # Installation cluster
    edgeapp_node: edgeapp # gke label name, leave blank if autopilot
    alo_node: alo # leave blank if autopilot
    alo_memory: 6500Mi
    storage: cloud-storage-dev-meerkat
    controller_image_address: 339713051385.dkr.ecr.ap-northeast-2.amazonaws.com/mellerikat/release/edge-app/amd/controller:3.6.0-rc.1
    iomanager_image_address: 339713051385.dkr.ecr.ap-northeast-2.amazonaws.com/mellerikat/release/edge-app/amd/iomanager:3.6.0-rc.1
    redis_image_address: 339713051385.dkr.ecr.ap-northeast-2.amazonaws.com/mellerikat/release/edge-app/amd/redis:v7.2.3
    namespace: gke-edge-app # k8s namespace
    serviceaccount: gke-edge-app # k8s service account

    ecr:
    token_renewable: true
    image_host: https://339713051385.dkr.ecr.ap-northeast-2.amazonaws.com

    pv:
    pv_enable: False

    conductor:
    host: edgecond.mellerikat-dev.com
    http_protocol: https
    port: 443
    wsprotocol: wss

    appinfo:
    data_input_path: gcp_test/input/
    data_ouput_path: gcp_test/output/
    data_input_policy: copy #'move','copy'
    data_save_policy: add_utc #'overwrite','add_utc','add_date'
    enable_result_to_edgecond: False
    Note: gcp-edgeapp-test
    ecr_token_enable: True

    cronjob:
    suspend: false
    base_image: asia-northeast3-docker.pkg.dev/nimble-sight-450802-a0/gcr-edgeapp-test/alpine/k8s:1.30.12
    onSchedule: "50 23 12 4 *"
    offSchedule: "50 23 12 4 *"
    api_server_endpoint: https://gke-3d9e615287614fea9ed3ae3765430baeaedf-684332823146.asia-northeast3-c.gke.goog # GKE DNS endpoint
    gcp_project_id: "nimble-sight-450802-a0"
    gcp_region: "asia-northeast3-c"
    gcp_aws_role: arn:aws:iam::339713051385:role/role-gke-an3-auditdx-dev-gke-edge-app-sa
    edgeapp_cronjob_ecr_secret: edgeapp-cronjob-ecr-secret-helm
    ecr_token_command: |
    curl -k -X POST https://kubernetes.default.svc/api/v1/namespaces/{namespace}/serviceaccounts/{serviceaccount}/token \
    -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
    -H "Content-Type: application/json" \
    --data '{"apiVersion": "authentication.k8s.io/v1", "kind": "TokenRequest", "spec": { "audiences": ["sts.amazonaws.com"], "expirationSeconds": 3600 }}' \
    --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
    > /home/response.json && \
    token=$(grep -o '"token": *"[^"]*"' /home/response.json | sed 's/"token": *"//g' | sed 's/"//g') && \
    echo "$token" > /home/token && \
    ECR_TOKEN="$(aws ecr get-login-password --region ${AWS_REGION})" && \
    kubectl delete secret --ignore-not-found {edgeapp_cronjob_ecr_secret} -n {namespace} && \
    kubectl create secret docker-registry {edgeapp_cronjob_ecr_secret} --docker-server={image_host} --docker-username=AWS --docker-password=${ECR_TOKEN} --namespace={namespace}
  • Edge App deletion

    helm uninstall [edgeapp name]

    (ex)

    helm uninstall example1
    helm uninstall example2
  • Update Helm configuration information

    helm upgrade [edgeapp name] ./edgeapp-package/edgeapp-manifest-[--version].tgz -n {namespace}
  • Alo deletion

    kubectl delete pod [alo pod name] -n {namespace}

5. Use after verification on Edge Conductor

  • 엣지 컨덕터상에서 사용자가 설치한 엣지가 보이는지 확인한다
    • ex) {edgetest} -> {serail-number}{edgetest}