Skip to content

Instantly share code, notes, and snippets.

@lukehoban
Created February 13, 2019 19:04
Show Gist options
  • Save lukehoban/b83f05404b1794d585c3a56574e2b7c8 to your computer and use it in GitHub Desktop.
Save lukehoban/b83f05404b1794d585c3a56574e2b7c8 to your computer and use it in GitHub Desktop.
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
// Create an AWS VPC and EKS cluster
const vpc = new awsx.Vpc("vpc", { usePrivateSubnets: false });
const cluster = new eks.Cluster("cluster", {
vpcId: vpc.vpcId,
subnetIds: vpc.subnetIds,
});
// Deploy a Helm chart into the EKS cluster.
const node = new k8s.helm.v2.Chart("node", {
repo: "bitnami",
chart: "node",
version: "4.0.1",
values: {
serviceType: "LoadBalancer",
}
}, { providers: { kubernetes: cluster.provider } });
let redisMasterLabels = { app: "redis-master" };
let redisMasterDeployment = new k8s.apps.v1.Deployment("redis-master", {
spec: {
selector: { matchLabels: redisMasterLabels },
template: {
metadata: { labels: redisMasterLabels },
spec: {
containers: [
{
name: "master",
image: "k8s.gcr.io/redis:e2e",
resources: { requests: { cpu: "100m", memory: "100Mi" } },
ports: [{ containerPort: 6379 }]
}
]
}
}
}
});
import * as pulumi from "@pulumi/pulumi";
import * as k8sjs from "./k8sjs";
let config = new pulumi.Config();
let redisMaster = new k8sjs.ServiceDeployment("redis-master", {
image: "k8s.gcr.io/redis:e2e",
ports: [6379]
});
let redisReplica = new k8sjs.ServiceDeployment("redis-replica", {
image: "gcr.io/google_samples/gb-redisslave:v1",
ports: [6379]
});
let frontend = new k8sjs.ServiceDeployment("frontend", {
replicas: 3,
image: "gcr.io/google-samples/gb-frontend:v4",
ports: [80],
allocateIpAddress: true,
isMinikube: config.getBoolean("isMinikube")
});
export let frontendIp = frontend.ipAddress;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment