Open pouryas opened 1 year ago
resolved this issue. Seems like traefik helm isn't compatible with the latest version of EKS so I had to manually specify 1.21 version when instantiating the eks cluster:
const cluster = new eks.Cluster('mlplatform-eks', { createOidcProvider: true, version: "1.21", });
thanks for updating this! major help!
AWS no longer supports version 1.21, so here is the revised index.ts code for 1.22+
Like pouryas mentioned we need to change the postgres version (currently 12.7). We also needed to change the Traefik helm chart, and another minor change in traefik.getResource. Here is the index.ts for ml-infra
import * as aws from '@pulumi/aws';
import * as eks from '@pulumi/eks';
import * as k8s from '@pulumi/kubernetes';
import * as random from '@pulumi/random';
import S3ServiceAccount from './S3ServiceAccount';
import TraefikRoute from './TraefikRoute';
// Create a Kubernetes cluster.
const cluster = new eks.Cluster('mlplatform-eks', {
createOidcProvider: true,
});
// Install Traefik
const traefik = new k8s.helm.v3.Chart('traefik', {
chart: 'traefik',
fetchOpts: { repo: 'https://traefik.github.io/charts' },
}, { provider: cluster.provider })
// Create PostgreSQL database for MLFlow - this will save model metadata
const dbPassword = new random.RandomPassword('mlplatform-db-password', { length: 16, special: false });
const db = new aws.rds.Instance('mlflow-db', {
allocatedStorage: 10,
engine: "postgres",
engineVersion: "12.7",
instanceClass: "db.t3.micro",
name: "mlflow",
password: dbPassword.result,
skipFinalSnapshot: true,
vpcSecurityGroupIds: [cluster.clusterSecurityGroup.id, cluster.nodeSecurityGroup.id],
username: "postgres",
});
// Create S3 bucket for MLFlow
const mlflowBucket = new aws.s3.Bucket("mlflow-bucket", {
acl: "public-read-write",
});
// Install MLFlow
const mlflowNamespace = new k8s.core.v1.Namespace('mlflow-namespace', {
metadata: { name: 'mlflow' },
}, { provider: cluster.provider });
const mlflowServiceAccount = new S3ServiceAccount('mlflow-service-account', {
namespace: 'default',
oidcProvider: cluster.core.oidcProvider!,
readOnly: false,
}, { provider: cluster.provider });
const mlflow = new k8s.helm.v3.Chart("mlflow", {
chart: "mlflow",
values: {
"backendStore": {
"postgres": {
"username": db.username,
"password": db.password,
"host": db.address,
"port": db.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 });
// Expose MLFlow in Traefik as /mlflow
new TraefikRoute('mlflow-route', {
prefix: '/mlflow',
service: mlflow.getResource('v1/Service','mlflow'),
namespace: 'default',
}, { provider: cluster.provider});
// Service account for models with read only access to models
const modelsServiceAccount = new S3ServiceAccount('models-service-account', {
namespace: 'default',
oidcProvider: cluster.core.oidcProvider!,
readOnly: true,
}, { provider: cluster.provider });
// Set ml.mycompany.com DNS record in Route53
new aws.route53.Record("record", {
zoneId: <YOUR_ZONE_ID>
name: "ml.yourcompany.com",
type: "CNAME",
ttl: 300,
records: [traefik.getResource('v1/Service', 'default/traefik').status.loadBalancer.ingress[0].hostname],
});
export const kubeconfig = cluster.kubeconfig;
export const modelsServiceAccountName = modelsServiceAccount.name;
export const traefik_hn= traefik.getResource('v1/Service', 'default/traefik').status.loadBalancer.ingress[0].hostname
export const mlfow_info= mlflow.getResource('v1/Service', 'default/mlflow')`
Hi there
Appreciate the great work for posting and uploading this. I'm struggling to deploy the infrastructure as is.
I've created a domain in route53 and inserted the domain name and the Zoneid in the code, and had to change the Postgres version from 11.10 to 11 as it threw an error with the 11.10 version but I'm getting a bunch of errors related to Traefik.
The diagnosis of the Pulumi provision is below:
`
Appreciate if someone can guide me through fixing this