Creating Kubernetes resources for the MDM machine learning service

The file mdm-ml_service.yml creates the Kubernetes resources ConfigMap, Deployment, Service, and Ingress for the MDM machine learning deployment. The file mdm-ml_hpa.yml creates an Auto Scaler for the machine learning service.

Before you begin

See the topic YAML files and scripts for deploying InfoSphere MDM on OpenShift or Kubernetes to download an archive containing mdm-ml_service.yml and mdm-ml_hpa.yml. Save both files to your Docker working directory (/mdm).

Take note of the following implementation details:
  • Auto Scaling works based on the percentage of CPU utilization.
  • The minimum number of replicas is two and the maximum is four.
    Tip: You can edit the replica limits as needed for your deployment.

About this task

Before creating these Kubernetes resources, you must update the YAML files to provide a number of details corresponding to your deployment needs.

Important: When using Machine Learning containers in a production environment, especially if you are using an HPA configuration in Kubernetes or OpenShift, be sure to follow these steps:
  1. Start a single ML service instance (one Kubernetes pod configuration) first and wait until it is ready. As part of starting up for the first time, the container creates a number of required database tables in Cassandra.
  2. After the first instance is ready, enable the HPA configuration to start further service instances for high availability and performance load balancing.
Failure to follow these steps could result in exceptions during table creation, leaving Cassandra in an undefined state.

Procedure

  1. Edit the mdm-ml_service.yml and mdm-ml_hpa.yml files.
  2. If this deployment uses custom namespaces, change the value of metadata.namespace for each resource defined in the YAML files.
  3. Update the following values in the ConfigMap section to match your deployment details:
    • Cassandra IP address/host name
    • port
    • user name
    • password
  4. In the Deployment section, provide the appropriate image name.
  5. Save your changes to mdm-ml_service.yml and mdm-ml_hpa.yml.
  6. Ensure that the certificate and key files used for security are in the .pem format.
  7. Provide a route to the MDM machine learning service using Ingress.
    1. Edit the file mdm-ml_secret.yml.
    2. Replace the tls.cert and tls.key values with appropriate values from your certificate and key files.
    3. Create a secret using the following command.
      kubectl create -f mdm-ml_secret.yml
  8. Create the ConfigMap, Deployment, Service, and Ingress resources for the MDM machine learning service by running the following commands.
    kubectl create -f mdm-ml_service.yml
    kubectl create -f mdm-ml_ingress.yml
  9. Start a single ML service instance (one Kubernetes pod configuration) first and wait until it is ready. As part of starting up for the first time, the container creates a number of required database tables in Cassandra.
  10. Create a HorizontalPodAutoscaler for the MDM machine learning service by running the following command.
    kubectl create -f mdm-ml_hpa.yml