Deploying MaxAI NBC Model

This section provides detailed instructions on how to deploy MaxAI's NBC model in the AWS.

Create Amazon EFS Access Points for AION NBC

To create EFS Access Point for AION NBC, follow the steps below:

  1. Log in to the AWS Management Console.
  2. Navigate to EFS via the search bar.
  3. Select Access Points from the left navigation menu.
  4. Click Create Access Point.
  5. Provide the following details:
    Field Value
    File system Use the default or an existing EFS
    Name (optional) cdp-aion-nfc
    Root directory path /app/AION/model/nfc
    User ID 0
    Group ID 0
    Secondary group IDs Leave blank
    Owner User ID 0
    Owner Group ID 0
    Access point permissions 0775
  6. Click Create Access Point.

Deploy NFC Model via Devtron

To deploy the NFC model, follow the steps below:

  1. Open Devtron dashboard, and navigate to the Chart Store and select Generic Helm Chart.
  2. Click Configure & Deploy.
  3. Under the Configuration section, paste and modify the following YAML template according to your environment.
  4. NFC Helm Configuration Template is provided below.
    data:
      - apiVersion: v1
        kind: PersistentVolume
        metadata:
          name: aion-nbc-prod-pv
        spec:
          capacity:
            storage: 50Gi
          accessModes:
            - ReadWriteMany
          persistentVolumeReclaimPolicy: Retain
          storageClassName: efs-sc
          csi:
            driver: efs.csi.aws.com
            volumeHandle: <AWS Access Point Id>::<AWS File System ID>
    
      - apiVersion: v1
        kind: PersistentVolumeClaim
        metadata:
          name: aion-nbc-prod-pvc
        spec:
          accessModes:
            - ReadWriteMany
          resources:
            requests:
              storage: 50Gi
          storageClassName: efs-sc
      - apiVersion: v1
        kind: ConfigMap
        metadata:
          name: aion-cdp-nbc-prod-config
        data:
          config.ini: |
            [AUTH]
            client_id=test
            client_secret=test
      - apiVersion: apps/v1
        kind: Deployment
        metadata:
          name: cdp-aion-nbc-prod-deployment
        spec:
          replicas: 2
          selector:
            matchLabels:
              app: cdp-aion-nbc-prod
          template:
            metadata:
              labels:
                app: cdp-aion-nbc-prod
            spec:
              containers:
                - name: cdp-aion-nbc-prod-container
                  image: { provide image repository: image tag}
                  imagePullPolicy: Always
                  ports:
                    - containerPort: 8000
                  volumeMounts:
                    - mountPath: /app/AION/config
                      name: aion-nbc-prod-volume
                    - mountPath: /app/AION/model
                      name: aion-nbc-prod-pvc-volume
                  resources:
                    requests:
                      memory: "4000Mi"
                      cpu: "2"
                    limits:
                      memory: "14000Mi"
                      cpu: "3"  
              volumes:
                - name: aion-nbc-prod-volume
                  configMap:
                    name: aion-cdp-nbc-prod-config
                - name: aion-nbc-prod-pvc-volume
                  persistentVolumeClaim:
                    claimName: aion-nbc-prod-pvc
    
    
      - apiVersion: v1
        kind: Service
        metadata:
          name: cdp-aion-nbc-prod-service
        spec:
          ports:
            - name: http
              port: 8000
              protocol: TCP
              targetPort: 8000
          selector:
            app: cdp-aion-nbc-prod
     
      - apiVersion: networking.k8s.io/v1
        kind: Ingress
        metadata:
          annotations: <Add annotation related to environment>        
          labels:
            app.kubernetes.io/instance: cdp-aion-nbc-prod
          name: cdp-aion-nbc-prod
        spec:
          ingressClassName: alb
          rules:
            - host: <HOST_DETAILS>
              http:
                paths:
                  - backend:
                      service:
                        name: cdp-aion-nbc-prod-service
                        port:
                          number: 8000
                    path: /*
                    pathType: ImplementationSpecific
    
      - apiVersion: keda.sh/v1alpha1
        kind: ScaledObject
        metadata:
          name: cdp-nbc-prod-scaledobject
          namespace: default
        spec:
          scaleTargetRef:
            name: cdp-nbc-deployment
          pollingInterval: 30
          cooldownPeriod: 300
          minReplicaCount: 1
          maxReplicaCount: 2
          idleReplicaCount: 0
          restoreToOriginalReplicaCount: true
          advanced:
            horizontalPodAutoscalerConfig:
              behavior:
                scaleDown:
                  stabilizationWindowSeconds: 300
                  policies:
                    - type: Percent
                      value: 100
                      periodSeconds: 60
          triggers:
            - type: prometheus
              metadata:
                serverAddress: <PROMETHEUS_SERVER_URL>
                metricName: cpuusage
                query: sum(rate(container_cpu_usage_seconds_total{pod=~"aion-cdp-nbc.*",container_name!="POD"}[5m]))*100
                threshold: "80"
            - type: prometheus
              metadata:
                serverAddress: <PROMETHEUS_SERVER_URL>
                metricName: memoryusage
                query: avg(container_memory_usage_bytes{pod=~"aion-cdp-nbc.*"}) / sum(kube_pod_container_resource_limits{pod=~"aion-cdp-nbc.*",resource="memory"}) * 100
                threshold: "80"
    Note: Replace placeholders such as <IMAGE_REPOSITORY>, <IMAGE_TAG>, <AWS_ACCESS_POINT_ID>, <HOST_DETAILS>, <PROMETHEUS_SERVER_URL> and <EFS_FILE_SYSTEM_ID> with your actual values.

Post-Deployment Verification

  • Go to the Devtron dashboard, and navigate to the Applications section.
  • Ensure the cdp-nfc container is in the Running state.
  • Check logs to verify successful startup and readiness.