Coder Social home page Coder Social logo

Comments (1)

shabieh2 avatar shabieh2 commented on June 9, 2024

I was able to fix this thanks to pouryas suggestion for version 1.21 in the last issue:

here is my revised index.ts file


import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as random from "@pulumi/random";
import * as k8s from "@pulumi/kubernetes";
import S3ServiceAccount from './S3ServiceAccount';
import TraefikRoute from './TraefikRoute';





// Create Kubernetes Cluster
const cluster = new eks.Cluster('mlplatform-eks', { createOidcProvider: true, version: "1.21", });


     



//Random password

const dbPassword = new random.RandomPassword('mlplatform-db-password', { length: 16, special: false });

// Create S3 bucket for MLFlow
const mlflowBucket = new aws.s3.Bucket("mlflow-bucket", {
  acl: "public-read-write",
});



// Create postgres db for model metadata in  mlflow

const mlflowDB  = new aws.rds.Instance("mlflow-db", {
  allocatedStorage: 32,  //GB 
  dbName: "mlflow",
  engine: "postgres",
  engineVersion: "12.7",
  instanceClass: "db.t3.medium",
  
  password: dbPassword.result,
  skipFinalSnapshot: true,
  username: "postgres",

  // Make sure that our EKS cluster has access to DB

  vpcSecurityGroupIds:[cluster.clusterSecurityGroup.id,cluster.nodeSecurityGroup.id]

});

// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;


//create artifact storage for MLflow


const artifactStorage = new aws.s3.Bucket("artifact-storage", {
    acl: "public-read-write",
    
});

//create k8s user 

const mlflowServiceAccount = new S3ServiceAccount('mlflow-service-account', {
    namespace: 'default',
    oidcProvider: cluster.core.oidcProvider!,
    readOnly: false,
  }, { provider: cluster.provider });

//Install MLFlow

const mlflow = new k8s.helm.v3.Chart("mlflow", {
    chart: "mlflow",

    values: {
        "backendStore": {
          "postgres": {
            "username": mlflowDB.username,
            "password": mlflowDB.password,
            "host": mlflowDB.address,
            "port": mlflowDB.port,
            "database": "mlflow"
          }},
           
        "defaultArtifactRoot": mlflowBucket.bucket.apply((bucketName: string) => `s3://${bucketName}`),
        "serviceAccount": {
          "create": false,
          "name": mlflowServiceAccount.name,
        }  
      },
    
    fetchOpts: {repo: "https://larribas.me/helm-charts"},
      },
   
   
      {provider: cluster.provider });



//Install traefik

const traefik = new k8s.helm.v3.Chart('traefik', {
  chart: 'traefik',
  fetchOpts: { repo: 'https://containous.github.io/traefik-helm-chart' },
}, { provider: cluster.provider })

export const hostname = traefik.getResource('v1/Service', 'traefik').status.loadBalancer.ingress[0].hostname;
   

const mlflowNamespace = new k8s.core.v1.Namespace('mlflow-namespace', {
  metadata: { name: 'mlflow' },
}, { provider: cluster.provider });

//make sure each request that  starts with /mlflow is routed to MLFlow

// Expose MLFlow in Traefik as /mlflow 
new TraefikRoute('mlflow', {
  prefix: '/mlflow',
  service: mlflow.getResource('v1/Service', 'mlflow'),
  namespace: 'default',
}, { provider: cluster.provider});




//make sure the website is routed to Traefik

new aws.route53.Record('dns-record',
{zoneId:"Z060229226WFJGC5MQT7D",  
// from aws route53. i registered my domain in aws (e.g. xyz.com) and it automatically creates a hostedzone. got zoneid from there
    name:"<SUBDOMAIN>",     // if your domain is xyz.com, you can have this be ml.xyz.com
    type:"CNAME",
    ttl:300,
    records: [traefik.getResource('v1/Service', 'traefik').status.loadBalancer.ingress[0].hostname]

    });

from mlplatform-workshop.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.